0

x = input("Enter roman numberal:")

I need to enter one roman numeral as a string and return the value. When I run the code above, I get that whatever I enter in as the string isn't defined. I just want x to represent the inputted string, what am I doing wrong?

I am using Python 2.7.3.

1 Answer 1

1

Use raw input

X = raw_input('enter value?')
Sign up to request clarification or add additional context in comments.

2 Comments

is there anyway to do that without raw_input or is that my only option for the most part?
input in Python 2.x treats what you enter as a Python expression and tries to evaluate it. So, you could also just enter quotes around your Roman numeral, so it comes in as a string. However, raw_input() is the best solution for a lot of reasons.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.