import osimport refrom xmlrpc.client import booleanimport sys####################################################defint_input(text):whileTrue:try: num =abs(int(input(text)))exceptValueError:print("Please enter a whole number (positive integer value).")else:return numdefyesno_input(text):whileTrue: yes =('y','yes','yah','yep','yeah','oui','ja','ci','si','hai') no =('n','no','nah','nope','non','nein','nee') yn =str(input(text)).lower().strip()if yn =='x': sys.exit()elif yn in yes: yn =Truereturn ynelif yn in no: yn =Falsereturn ynelse:print("Enter the letter 'Y' for Yes, or the letter 'N' for No.")##################################################### exit = input().lower()# if exit == 'x':# sys.exit()defholiday(): shoetypes =['primary pair'] hiking =None trainers =None heels =None formal_heels =Nonedefresult(): pairs_number =len(shoetypes)if pairs_number <2:print("You'll be needing "+str(pairs_number)+" pair of shoes, namely your: "+(', '.join(shoetypes)))else:print("You'll be needing "+str(pairs_number)+" pairs of shoes, namely your: "+(', '.join(shoetypes)))# shoe types = "primary pair", "blister back ups", "hiking boots", "sandals", "indoor shoes / slippers", "flip flops", "formal heels", "fun (heeled) shoes", "gym trainers", "running trainers"print("Welcome to this invaluable Python script that will help you only pack the pairs of shoes you *really* need to bring with you on holiday. \nThis has been designed to keep the number of pairs to a sensible minimum.") days_away = int_input("For how many days will you be gone?\n")if days_away =="0":print("You are not really travelling, are you?")#maybe enter a funny link to something to entertain themelif days_away =="1":print("You are travelling for "+str(days_away)+" day. I don't think you need this script. (Not that anyone else really does either). Have a fun day trip!")#make 'day' if input is 1else:print("You are travelling for "+str(days_away)+" days. \n Think of the pair of shoes that you intend to bring as your 'primary' pair to wear the most often.") primary_discomfort = yesno_input("Do these shoes ever get uncomfortable?\n")# days_away = int(days_away) walking = yesno_input("Will there be a lot of walking involved?\n")if walking isTrue: hiking = yesno_input("Does this walking include actual hiking that requires hiking boots?\n")if walking isTrueand hiking isFalseand primary_discomfort isTrue: trainers = yesno_input("Could you bear to be seen walking in potentially less fashionable shoes, such as a pair of trainers, for the sake of comfort?\n")if trainers isTrue: shoetypes.append('secondary pair')print(shoetypes)if trainers isFalse:print("Enjoy your blisters.")if hiking isTrue: hiking_primary = yesno_input("Are your primary shoes already hiking shoes?\n")if hiking_primary isTrue:print("Unless this is a backpacking trip or hiking expedition, kindly rethink your fashion choices.")# if input value = 'X': abort and start over shoetypes.remove('primary pair') shoetypes.append('hiking boots')else:print("Thank goodness.") shoetypes.append('hiking boots') summer = yesno_input("Is it a warm location where you'd like to bring a pair of sandals?\n")if summer isTrue: summer_primary = yesno_input("Are your primary shoes already a pair of sandals?\n")if summer_primary isTrueand primary_discomfort isTrue: shoetypes.remove('primary pair') shoetypes.extend('sandals','secondary sandals')elif summer_primary isTrue: shoetypes.remove('primary pair','sandals')else: shoetypes.append('sandals') flipflops = yesno_input("Will you be showering somewhere where you are concerned about picking up Athlete's Foot? E.g. shared showers, beaches?\n") flipflops_2 = yesno_input("Is there a beach or pool setting, etc.?\n")if flipflops isTrueor flipflops_2 isTrue: shoetypes.append('flip flops') houseshoes = yesno_input("Will you be staying somewhere where you should wear slippers indoors (e.g. cultural reasons or a cold house)?\n")if houseshoes isTrue: shoetypes.append('slippers for indoors') formal = yesno_input("Do you have a formal occasion(s) to attend while away?\n") fancy = yesno_input("Do you have any fun and fancy occasion(s) lined up on your trip, such as a party?\n")if formal isTrueor fancy isTrue: heels = yesno_input("Are you one to ever wear heels?\n")if formal isTrue: formal_primary = yesno_input("Are your regular shoes formal enough for your formal occasion(s)?\n")if formal_primary isFalseand heels isTrue: formal_heels = yesno_input("Would you want to wear heels to the formal event(s)?\n")if formal_heels isTrue: shoetypes.append('formal heels')elif formal_heels isFalse: shoetypes.append('formal shoes')elif formal_primary isFalse: shoetypes.append('formal shoes')if fancy isTrue: fancy_primary = yesno_input("Are your primary shoes adaptable to the party scene?\n")if fancy_primary isFalseand formal_heels isTrue: fancy_heels = yesno_input("Would you want to wear heels other than your formal heels to your fancy event(s)?\n")if fancy_heels isTrue: shoetypes.append('fancy heels')elif fancy_primary isFalseand heels isTrue: fancy_heels_2 = yesno_input("Would you want to wear heels to your fancy event(s)?\n")if fancy_heels_2 isTrue: shoetypes.append('fancy heels')elif fancy_primary isFalse: shoetypes.append('fancy shoes') gym = yesno_input("Do you truly intend to visit a gym while away?\n") run = yesno_input("Do you truly intend to go on more than one run while away?\n")if gym isTrueand run isTrueand trainers isTrue: gym_secondary = yesno_input("Could you use the secondary pair of shoes you are already bringing for the gym?\n") run_secondary = yesno_input("Could you use the secondary pair of shoes you are already bringing for running?\n")if gym_secondary isTrueand run_secondary isFalse: shoetypes.append('running shoes')elif gym_secondary isFalseand run_secondary isTrue: shoetypes.append('gym shoes')elif gym_secondary isFalseand run_secondary isFalse: gym_run = yesno_input("Could you use the same pair for the gym and for running? (Or are you precious about your gym shoes not ever touching outdoor ground)?\n")if gym_run isTrue: shoetypes.append('trainers')if gym_run isFalse: shoetypes.extend('gym shoes','running shoes')elif gym isTrueand run isTrueand trainers isFalse: gym_run_2 = yesno_input("Could you use the same pair for the gym and for running? (Or are you precious about your gym shoes not ever touching outdoor ground)?\n")if gym_run_2 isTrue: shoetypes.append('trainers')if gym_run_2 isFalse: shoetypes.extend('gym shoes','running shoes')elif gym isTrue: shoetypes.append('gym shoes')elif run isTrue: shoetypes.append('running shoes') misc = yesno_input("Are you going skiing, or on some other holiday that requires you bringing shoes/boots for such niche activities?\n")if misc isTrue: misc_number = int_input("How many separate pairs of activity-specific shoes/boots does this involve?\n")for _ inrange(misc_number): misc_shoes =input("Enter your name for one miscellaneous pair:\n") shoetypes.append(misc_shoes) result()holiday()