Conditional statements; for AND while loops; screen input and output; debugging; Python arithmetic; four data types

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/27

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

28 Terms

1
New cards

for i in range(#,#):

A loop structure that allows the execution of a block of code a specific number of times.

2
New cards

Output of 'for i in range(6): print(i)'

0, 1, 2, 3, 4, 5

3
New cards

for i in range(1,7): print(i)

This prints numbers starting from 1 up to 6, resulting in: 1, 2, 3, 4, 5, 6.

4
New cards

for i in range(10,41,5)

This prints numbers starting from 10 to 40, counting by fives: 10, 15, 20, 25, 30, 35, 40.

5
New cards

str

A variable type that holds a string or text.

6
New cards

int

A variable type that represents an integer (whole) number.

7
New cards

float

A variable type that represents a decimal number.

8
New cards

bool

A variable type that represents a boolean value, either True or False.

9
New cards

X = True

An example of a boolean variable assignment in Python.

10
New cards

Python Variables

Names that can only include letters, numbers, and underscores, cannot start with a number.

11
New cards

Reserved Words in Python

Keywords like while, in, and else that cannot be used as variable names.

12
New cards

Case-sensitive names

Variable names in Python are case-sensitive, meaning 'var' and 'Var' are different.

13
New cards

Variable Naming Convention

It is recommended to use lowercase letters and underscores for variable names.

14
New cards

int(input(“____________”))

Usage of input function to get an integer from the user.

15
New cards

if something is true:

print(________)

A conditional statement to execute code if a certain condition is met.

16
New cards

elif something is true: print(________)

An additional conditional statement that checks another condition if the previous is false.

17
New cards

else: print(________)

A fallback option that executes if none of the previous conditions are true.

18
New cards

** in Python

The operator used to calculate exponents.

19
New cards

*in Python

The operator used for multiplication.

20
New cards

/ in Python

The operator used for division.

21
New cards

% in Python

The operator that gives the remainder of division.

22
New cards

// in Python

The operator that rounds down the result of division.

23
New cards

-in Python

The operator used for subtraction.

24
New cards

+in Python

The operator used for addition.

25
New cards

print(i)

A function used to display output or values in Python.

26
New cards

range(start, stop)

A built-in function that generates a sequence of numbers from start to stop, not including stop.

27
New cards

range(start, stop, step)

A built-in function that generates numbers from start to stop, increasing by step.

28
New cards

Counting with 'for' loops

'for' loops are commonly used for iterating over a range of numbers in Python.