Python Forum
Using answers from an input function - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Using answers from an input function (/thread-19904.html)



Using answers from an input function - Totalartist - Jul-19-2019

I've decided to teach myself programming and am new to the science. I started with a book on python and often try write code that's more complex than the examples provided in the book.

To get to the point here is an example from the book about the if and elif statements.
print("1. Red")
print("2. Orange")
print("3. Yellow")
print("4. Green")
print("5. Blue")
print("6. Purple")
Choice = int(input("Select your favorite color: "))
if (Choice == 1):
    print("You chose Red!")
elif (Choice == 2):
    print("You chose Orange!")
elif (Choice == 3):
    print("You chose Yellow!")
elif (Choice == 4):
    print("You chose Green!")
elif (Choice == 5):
    print("You chose Blue!")
elif (Choice == 6):
    print("You chose Purple!")
else:
    print("You made an invalid choice!")



RE: Using answers from an input function - Yoriz - Jul-19-2019

Welcome to the forum, did you have a question ?


RE: Using answers from an input function - Totalartist - Jul-19-2019

I did, but when I wanted to change the post because I accidentally posted it without finishing the question it said that "I couldn't make changes to a post that older than 10 mins".


RE: Using answers from an input function - snippsat - Jul-19-2019

Just post your question in other post under,there is a restrictions to 10 mins for 0-4 posts users.
When have over 5 posts can edit up to 48 hours.
Permissions and Groups.