If you input 4 * 5 can you take that input and run it as a operation? [Python 3] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

If you input 4 * 5 can you take that input and run it as a operation? [Python 3]

a = input(‘Calculator: ‘) a = int(a) print(a) Sorry I’m not a professional. I learn Python as a new skill so that I don’t waste my holidays. And I’m 12...

4th Dec 2019, 1:58 PM
Adriel Low
Adriel Low - avatar
1 Answer
+ 1
no it will not work, because int(a) expect an int and * is not a number. use a function instead like def mult(x, y) : return x * y get two inputs a and b a = mult(a, b)
4th Dec 2019, 2:09 PM
Bahhaⵣ
Bahhaⵣ - avatar