# [ ] print a string that outputs the following exactly: The new line character is "\n"
print("The new line character is \"\\n\"")
The new line character is "\n"
# [ ] print output that is exactly (with quotes): "That's how we escape!"
print("\"That/'s how we escape!\"")
"That/'s how we escape!"
# [ ] with only 1 print statement and using No Space Characters, output the text commented below
# 1 one
# 22 two
# 333 three
print("1\tone\n22\ttwo\n33\tthree")
1 one
22 two
33 three
# [ ] create and test quote_me()
def quote_me():
quote=input("Can I quote you?")
if quote.startswith("\""):
quote="\'"+quote+"\'"
print(quote)
elif quote.startswith("\'"):
quote="\""+quote+"\""
print(quote)
else:
quote="\""+quote+"\""
print(quote)
quote_me()
"Help I am going crazy"
# [ ] create shirt order using nested if
def shirt_order ():
shirt_color=input("What color shirt? Enter Blue or White").lower()
if shirt_color.startswith("b"):
print("That color is available in Medium and Small. Enter S or M: ")
shirt_size=input("What size shirt? S or M").upper()
if shirt_size.startswith("S"):
print("You ordered a small, blue shirt.")
elif shirt_size.startswith("M"):
print("You ordered a medium, blue shirt.")
else:
print("That isn't a valid choice...")
elif shirt_color.startswith("w"):
print("That color is available in Medium and Large. Enter L or M: ")
shirt_size=input("What size shirt? M or L")
if shirt_size.startswith("L"):
print("You ordered a large, white shirt.")
elif shirt_size.startswith("M"):
print("You ordered a medium, white shirt.")
else:
print("That isn't a valid choice...")
shirt_order()
That color is available in Medium and Small. Enter S or M:
You ordered a small, blue shirt.
# [ ] create and test str_analysis()
def str_analysis():
words=input("Enter a number or a word:")
if words.isdigit():
if int(words)>99:
print("That\'s a big number.")
else:
print("Aww, its just a little guy...")
elif words.isalpha():
print("Thanks for the word...")
else:
print("That isn\'t a word or a number.")
str_analysis()
That isn't a word or a number.
# [ ] create and call ticket_check()
def ticketCheck(section, seats):
approved = False
if section .lower() .startswith("g"):
if int(seats) >0:
if int(seats) <11:
approved = True
print("Approved:", approved)
else:
print("You must order between 1-10 tickets")
else:
print("You must order between 1-10 tickets")
elif section .lower() .startswith("f"):
if int(seats) >0:
if int(seats) <5:
approved = True
print("Approved:", approved)
else:
print("You must order between 1-4 tickets")
else:
print("You must order between 1-4 tickets")
else:
print("Approved:", approved)
ticketCheck(input("Would you like to sit in the floor section or general section? "), (input("How many seats would you like? ")))
Approved: True