Skip to content
introduction to python excercise
# Start coding here...
print(3 + 4)
print(42)
print(2)
# Initialize offset
offset = -6
# Code the while loop
while offset != 0 :
print("correcting...")
if offset > 0 :
offset = offset - 1
else :
offset = offset + 1
print(offset)
a = 32
print(type(a))
knowing the type
print(4**2)
print(2/4)
print(7 % 3)
print(4 *4)
print(3-3)
love = "I LOVE AMONIYAN"
print(love)
income = 400000
outcome = 3000
remaining = income - outcome
print(remaining)
income = 40000
statement = "my money is"
print(statement + " " + str(income))
print(float("3") + 33)
print(bool(4), bool("yes"), bool(0), bool(33))
repeating strings word = Adeife multiple = word * 4 print(multipl)
word = "Adeife" " "
multiple = word * 4
print(multiple)
#page 12 to 14 in introduction to python
x = ["h", 2, 40, "m", "love"]
print(x[-1])
x[1] = 30
print(x)
del(x[3])
print(x)
print(x[:2])
print([1])
y = ["jide can kill"]
z = [x + y]
print(z)
x = ["hanner", 40, 33]
y = ["jide", 22]
z = [" authentic", 23]
total = [x, y, z]
print(total)
#refrencing and slicing
a = 4
b = a
a = 3 # when you change the innitail variable, the copy will not be affected. list is exception to this rule
print(b)