You have the following:
1. This is not typecasting, it is conversion. The
int
function takes a string of digits and converts it to an integer value.
2. Again,
str
is a function that takes a numeric value and converts it into a string of digits.
However in case 2 it is not necessary as the print function will automatically convert numerics to strings in order to display them correctly. Although you would need to modify the print statement to:
print(num, " X ", i, "=", i * num)