Strong Typing in Python
The peculiarity of Python is strong typing objects. This means that we cannot directly interact with objects of different types. For example, we cannot add a number and a string:
pythonnum = 12
txt = 'ab'
print(num + txt) # will display an error
To solve this problem, you need to convert both objects to the same type. You will learn how to do this in the following lessons.
Задание 1
Without running the code, determine what will be output to the console screen:
pythontst1 = 5
tst2 = 10
print(tst1 + tst2)
Задание 2
Without running the code, determine what will be output to the console screen:
pythontst1 = 5
tst2 = '10'
print(tst2 - tst1)
Задание 3
Without running the code, determine what will be output to the console screen:
pythontst1 = '123'
tst2 = '456'
print(tst1 + tst2)