Checking for Equality in Python
To test two values for equality, use the operator ==.
Let there be a variable:
pythontst = 3
Let's find out if it is equal to 0:
pythonif tst == 0:
print('+++')
else:
print('---') # will this work
Now let's change the value of the variable so that the condition is met:
pythontst = 0
if tst == 0:
print('+++') # this will work
else:
print('---')
Задание 1
Given a variable:
pythontst = 25
Check that it is equal to 10.
Задание 2
The following code is given:
pythontst = '123'
if tst == 123:
print('+++')
else:
print('---')
Tell me what will be output to the console.
Задание 3
The following code is given:
pythontst = ['a', 'b, 'c', 'd']
if len(tst) == 5:
print('+++')
else:
print('---')
Tell me what will be output to the console.