if i want it to be based on user input? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

if i want it to be based on user input?

how should the code look like if i want the num to be based on user input?

1st Oct 2016, 11:48 AM
erez
4 Answers
+ 1
if youre using python 3 you use input(). code could be something like: numb1 = input("choose #1 ") numb2= input("choose #2 ") print(int(numb1) * int(numb2)) python 2 just do raw_input instead if just input you need to convert them to an integer. can be done when asking them (i.e numb1= int(input("choose #1 )) ) or at the end like above.
1st Oct 2016, 2:10 PM
alex
alex - avatar
0
maybe you can use the raw_input method
1st Oct 2016, 1:32 PM
alex
alex - avatar
0
i know it has to be with input(), but hows the code should be? my attempts lead to errors
1st Oct 2016, 1:35 PM
erez
0
thanks! conversion was what im missing out!
1st Oct 2016, 2:29 PM
erez