Forum Archive

How do you divide in python

bryan.cheng04

How do you divide in Pythonista?```
print ("hi")

option = raw_input("Enter a input for meter: ")

feet = option / 0.3048

print (feet)
```

ellie_ff1493

its just input and you need an number instead of a str

print("hi")

option = input("Enter a input for meter: ")

feet = float(option) / 0.3048

print(feet)
dgelessus

Note: in Python 3 you need to use input, but in Python 2 you need to use raw_input to do the same thing. (Python 2 also has an input function, but that does something different.)

If you're a beginner, I would stronly recommend using Python 3 and not Python 2. Python 3 the current version of the language, has some nice new features, and has less strange/confusing behavior than Python 2 in some places.