How to make an calculation on variables? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make an calculation on variables?

When i try to do it (num1 = 3, num2= 2) it returns me 32.

26th Nov 2019, 4:59 PM
bemXio
bemXio - avatar
6 Answers
+ 1
You have to turn your input (string) into real numbers: num1 = float(num1) Or directly: num1 = float(input())
26th Nov 2019, 5:14 PM
HonFu
HonFu - avatar
+ 2
We don't know what program/tutorial/book or whatever you are referring to. Can you give us some context?
26th Nov 2019, 5:03 PM
HonFu
HonFu - avatar
26th Nov 2019, 5:07 PM
bemXio
bemXio - avatar
+ 1
Thanks for help!
26th Nov 2019, 5:15 PM
bemXio
bemXio - avatar
0
Both your inputs are strings.
26th Nov 2019, 5:10 PM
rodwynnejones
rodwynnejones - avatar
0
so, how to change the inputs to fix this? (sorry, i'm new to programming)
26th Nov 2019, 5:13 PM
bemXio
bemXio - avatar