Example:
num1=input('input the first num: ')
num2=input('input the second num: ')
num3=num1*num2
print(num3)
After execution, the result is: input the first num: at this time, enter the integer on the keyboard and press enter
Input the second num: enter the integer again and press enter
Can’t multiply sequence by non int of type ‘float’
Reason: the input() function inputs a string format, so the integer you enter on the keyboard is not a positive integer, but a string format. Therefore, when executing the statement Num3 = num * num, an error will be reported. Because num1 and num2 are both strings, they cannot be multiplied
Solution: convert num1 and num2 into integers
Specific solutions
1. The third line of the code is changed to: Num3 = int (num1) * int (num2)
2. Change the first and second lines to: num1 = int (input (‘input the first num: ‘)
num2=int(input(‘input the first num: ‘))