DS | 2.1

0.0(0)
Studied by 4 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/16

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:29 AM on 9/22/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

17 Terms

1
New cards

what is an algorithm?

a precise, step-by-step

solution to a problem

2
New cards

what is a Counting type (int)?

0-9, can be positive or negative, is discrete (meaning no decimals)

3
New cards

How do you declare an int?

Examples:

age = 18
bank balance = 0

Net worth = -7

4
New cards

What is a Floating-point arithmetic type (a float)?

similar to a decimal number in math (3.4, 4.33, -1.22)

5
New cards

What function gives the absolute value, and how do you use it?

abs()


Example: abs(-3.2) (you’d get 3.2)

6
New cards

what function gives you the minimum from a list of numbers?

min()


Example: min(2,3,6,2,1) (you’d get 1)

7
New cards

what function gives you the maximum from a list of numbers?

max()


Example: max(2,3,6,2,1) (you’d get 6)

8
New cards

What characters can a variable contain?

lowercase, uppercase, underscore, digits 0-9

9
New cards

How do you use the print statement for strings?

print(‘hola’)

print(“hola”)

10
New cards

How do you use the print statement for int/float?

print(0)

print(2.3)

11
New cards

how to concatenate strings and variables in a print statement

(how to have both a string and a variable in the same line, for example “Anna is 24 years old”)

age = 25

print("Anna is", age, "years old.")


OR


print("I am " + str(age) + " years old.")

do NOT do:

print("Anna is " + 25 + “years old”) (25 gotta be in a variable first)


12
New cards

How to keep output on the same line

end= ‘ ‘

example:

print(‘hello there.’ , end= ‘ ‘)

print(‘my name is….’ , end= ‘ ‘)

print(‘Santos’)


would print, (Hello there. my name is… Santos)

13
New cards

How to get user input in python:

use the input() function

Example:

name = input(‘What is your name?: ‘)

(then the user inputs and their name is stored in the variable)

14
New cards

The three type conversion functions: (changing from int to float to string)

int()
float()

str()

15
New cards

if u got time try to:

Requests the user’s name

2. Requests the user’s age

3. Computes the user’s age one year from

now and prints the message shown


if u dont got time mark this as correct (in the settings of the flashcards you can turn on manual override it might restart u tho mb)

name = input('Enter your name: ')

age = int(input('Enter your age: '))

line = name + ', you will be ' + str(age+1) + ' next year!'

print(line)

16
New cards

How to manipulate floating point output (digits)

f’{variable.digitsuneed & f}’

example
pi = 3.18273737373
print(pi reduced to 3 digits: “ , f’{pi.3f}’)

17
New cards

What is an f string?

fastest way to keep variables inside strings

example:
tempereture = 3
print(f“its like {temperture} degrees outside rn”)