forked from b-tomi/100DaysOfCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
30 lines (25 loc) · 824 Bytes
/
main.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
# Band Name Generator
print("Welcome to the Band Name Generator.")
# initialize the variables as empty strings
city = ""
pet_name = ""
# simple check to make sure the user has entered something
while True:
print("What's the name of the city you grew up in?")
city = input("> ")
# if there's no input, ask again
if city == "":
print("You haven't entered anything. Please try again.")
# if there's any input at all, break out of the loop
else:
break
# do the same for the pet name
while True:
print("What's your pet's name?")
pet_name = input("> ")
if pet_name == "":
print("You haven't entered anything. Please try again.")
else:
break
# output using f-strings makes the code much more readable
print(f"Your band name could be {city} {pet_name}.")