I have written this code which provides advice based on user's favourite YouTuber. I wonder if there is a better way to do absolutely any of it. Also, if there is any way to optimise it or if there is a problem please also tell me preferably with fixed code as I am still sort of a beginner. The code is below:
import random
def test():
youtuber = input('Enter your favourite youtuber: ')
youtuber = youtuber.lower()
favouriteYoutuber = ['Dr. Phil', 'Mr. Beast', 'T-Series', 'PewDiePie', '5 Minute Crafts', 'The Ellen Show']
if youtuber == 'dr. phil':
print('You are an awesome lad!')
elif youtuber == 'james charles':
print('Errmm. Ok...')
elif youtuber == 'bloamz':
print('Ok then.')
elif youtuber == 'ali a':
print('I mean. Thats old but ok...')
elif youtuber == 'jacksepticeye':
print('Thats kinda cool')
elif youtuber == 'will smith':
print('Thats different. I rate that')
elif youtuber == 'jack black':
print('you have good taste')
elif youtuber == 'jack white':
print('I like him as well')
elif youtuber == 'dr. mike':
print('so you like learning then')
elif youtuber == 'morgz':
print('I mean just leave now')
else:
print('I dont know that one. Ill check them out')
print('my favourite youtuber is ' + random.choice(favouriteYoutuber))
def try_again():
again = True
while again:
test()
while True:
try:
print("")
print("Would you like to try again?")
maybe = input("Y/N ")
maybe = maybe.lower()
except ValueError:
print("That is not a valid option")
print("")
continue
if maybe in ('y','n'):
if maybe == "n":
print("")
again = False
elif maybe == "y":
print("")
break
else:
print("Thank you for using this app!")
try_again()