Looks like no one added any tags here yet for you.
for i in range(#,#):
A loop structure that allows the execution of a block of code a specific number of times.
Output of 'for i in range(6): print(i)'
0, 1, 2, 3, 4, 5
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.
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.
str
A variable type that holds a string or text.
int
A variable type that represents an integer (whole) number.
float
A variable type that represents a decimal number.
bool
A variable type that represents a boolean value, either True or False.
X = True
An example of a boolean variable assignment in Python.
Python Variables
Names that can only include letters, numbers, and underscores, cannot start with a number.
Reserved Words in Python
Keywords like while, in, and else that cannot be used as variable names.
Case-sensitive names
Variable names in Python are case-sensitive, meaning 'var' and 'Var' are different.
Variable Naming Convention
It is recommended to use lowercase letters and underscores for variable names.
int(input(“____________”))
Usage of input function to get an integer from the user.
if something is true:
print(________)
A conditional statement to execute code if a certain condition is met.
elif something is true: print(________)
An additional conditional statement that checks another condition if the previous is false.
else: print(________)
A fallback option that executes if none of the previous conditions are true.
** in Python
The operator used to calculate exponents.
*in Python
The operator used for multiplication.
/ in Python
The operator used for division.
% in Python
The operator that gives the remainder of division.
// in Python
The operator that rounds down the result of division.
-in Python
The operator used for subtraction.
+in Python
The operator used for addition.
print(i)
A function used to display output or values in Python.
range(start, stop)
A built-in function that generates a sequence of numbers from start to stop, not including stop.
range(start, stop, step)
A built-in function that generates numbers from start to stop, increasing by step.
Counting with 'for' loops
'for' loops are commonly used for iterating over a range of numbers in Python.