0
User input program
Hie I'm new to Python (to programming in fact).Can you please help me on how to create a program that requires the user to enter (inputs function ) two integers and multiple them
2 ответов
+ 4
num1=int(input("Enter a number: "))
num2=int(input("Enter another number: "))
print(num1*num2)
Let's break it down. The first line is creating a variable to store the first number. by default input() is a string. Since we want integers, we wrap the input inside of int(). This lets python know that num1 is in fact an integer. The next line repeats this process to store a second number as num2. The third line prints the output of num1 multiplied by num2
+ 1
Thanks, be blessed