0

what am I missing? I thought I copied this well from the solo learn examples.

/data/data/com.hipipal.qpy3/files/bin/qpython-android5.sh "/storage/emulated/0/com.hipipal.qpyplus/.last_tmp.py" && exit pyplus/.last_tmp.py" && exit < options: Enter 'add' to add two numbers: Enter 'sub' to subtract two numbers: Enter 'mult' to multiply two numbers: Enter 'div' to divide two numbers: Enter 'quit' to end program: :add Traceback (most recent call last): File "/storage/emulated/0/com.hipipal.qpyplus/.last_tmp.py", line 14, in <module> num1 = (float("Enter a number:")) ValueError: could not convert string to float: 'Enter a number:' 1|u0_a24@jactivelteatt:/ $

25th Jul 2016, 2:34 PM
lite
1 Resposta
+ 1
the error appears because with: float("Enter a number:") you are asking python interpreter to convert "Enter a number" into number which confuses it. what you may have wanted is to write something like: num1 = float(input("Enter a number:")) which would take user input and converti it to number. i don't know what's the rest of your code, so i might be wrong about that line.
25th Jul 2016, 5:18 PM
RedAnt
RedAnt - avatar