forked from CaptCorpMURICA/100DaysPython
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule2_day17_userInput.py
46 lines (42 loc) · 2.42 KB
/
module2_day17_userInput.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
Author: CaptCorpMURICA
Project: 100DaysPython
File: module2_day17_userInput.py
Creation Date: 6/6/2019, 9:25 PM
Description: Learn about the basics of user input with python.
"""
# The `input()` function prompts the user for input. The program is paused until the user presses the `Enter` key.
print(input())
# The text within the `input()` function is the prompt for the user. This can help direct the user to provide a valid
# input.
print(input("How many questions will you get asked?"))
# The results from the `input()` function can be stored in a variable for use within the program.
name = input("What is your name?")
print(name)
# The `input()` function can be combined with other, previously discussed, functions to create an interactive game.
resp = input("Do you approach the bridge keeper? (y/n)")
if "y" in resp.lower():
print("Those who approach the Bridge of Death must answer me these questions three. There the other side he see.")
print(input("How do you respond?"))
name = input("What is you name?")
print(name)
quest = input("What is you quest?")
print(quest)
answer = input("What is the airspeed velocity of an unladen swallow?")
if "african" in answer.lower() or "european" in answer.lower():
print("I...I don't know that!")
print("The bridge keeper is hurtled into the pit and you are free to cross.")
elif "i don't know" in answer.lower():
print("{}, you are hurled into the pit and your quest to {} has come to an end.".format(name.capitalize(),
quest))
elif "wait" in answer.lower():
print("{}, you are hurled into the pit and your quest to {} has come to an end.".format(name.capitalize(),
quest))
else:
print("'{}' was a good enough answer. You cross the bridge and continue your quest to {}.".format(answer,
quest))
elif "n" in resp.lower():
print("Just like Sir Robin, you soiled your armor you were so scared. You leave the Bridge of Death, defeated by "
"your own cowardice.")
else:
print("For being unable to provide a Yes or No, you are hurled into the pit and your quest is over.")