Made By: Perry
Variables - Variables are assigned values using the =
operator. They can any value of different data types like strings, integers and floats
Operators - Operators are symbols like * / + -
. They can be used to perform mathematic and arithmetic operations.
Commenting - Commenting can be done by using #
to explain what you code does.
String
stringExample = 'Hello, I am a string'
Integer
integerExample = 420
Float
floatExample = 420.5
Boolean
boolExample = true
a = 200
b = 33
if b > a:
print("b is greater than a")
elif a == b:
print("a and b are equal")
else:
print("a is greater than b")
While loops
i = 1
while i < 6:
print(i)
i += 1
For loops
for x in "banana":
print(x)
print()
- prints the value of the variable or string inside the brackets
.format()
- replaces the placeholders that are made from curly brackets
.upper()
- change a string to uppercase letters
input()
- ask a user for input which then be assigned to variables