```
import os
import re
from xmlrpc.client import boolean
import sys
####################################################
def int_input(text):
while True:
try:
num = abs(int(input(text)))
except ValueError:
print("Please enter a whole number (positive integer value).")
else:
return num
def yesno_input(text):
while True:
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 = True
return yn
elif yn in no:
yn = False
return yn
else:
print("Enter the letter 'Y' for Yes, or the letter 'N' for No.")
####################################################
# exit = input().lower()
# if exit == 'x':
# sys.exit()
def holiday():
shoetypes = ['primary pair']
hiking = None
trainers = None
heels = None
formal_heels = None
def result():
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 them
elif 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 1
else:
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 is True:
hiking = yesno_input("Does this walking include actual hiking that requires hiking boots?\n")
if walking is True and hiking is False and primary_discomfort is True:
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 is True:
shoetypes.append('secondary pair')
print(shoetypes)
if trainers is False:
print("Enjoy your blisters.")
if hiking is True:
hiking_primary = yesno_input("Are your primary shoes already hiking shoes?\n")
if hiking_primary is True:
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 is True:
summer_primary = yesno_input("Are your primary shoes already a pair of sandals?\n")
if summer_primary is True and primary_discomfort is True:
shoetypes.remove('primary pair')
shoetypes.extend('sandals', 'secondary sandals')
elif summer_primary is True:
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 is True or flipflops_2 is True:
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 is True:
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 is True or fancy is True:
heels = yesno_input("Are you one to ever wear heels?\n")
if formal is True:
formal_primary = yesno_input("Are your regular shoes formal enough for your formal occasion(s)?\n")
if formal_primary is False and heels is True:
formal_heels = yesno_input("Would you want to wear heels to the formal event(s)?\n")
if formal_heels is True:
shoetypes.append('formal heels')
elif formal_heels is False:
shoetypes.append('formal shoes')
elif formal_primary is False:
shoetypes.append('formal shoes')
if fancy is True:
fancy_primary = yesno_input("Are your primary shoes adaptable to the party scene?\n")
if fancy_primary is False and formal_heels is True:
fancy_heels = yesno_input("Would you want to wear heels other than your formal heels to your fancy event(s)?\n")
if fancy_heels is True:
shoetypes.append('fancy heels')
elif fancy_primary is False and heels is True:
fancy_heels_2 = yesno_input("Would you want to wear heels to your fancy event(s)?\n")
if fancy_heels_2 is True:
shoetypes.append('fancy heels')
elif fancy_primary is False:
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 is True and run is True and trainers is True:
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 is True and run_secondary is False:
shoetypes.append('running shoes')
elif gym_secondary is False and run_secondary is True:
shoetypes.append('gym shoes')
elif gym_secondary is False and run_secondary is False:
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 is True:
shoetypes.append('trainers')
if gym_run is False:
shoetypes.extend('gym shoes', 'running shoes')
elif gym is True and run is True and trainers is False:
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 is True:
shoetypes.append('trainers')
if gym_run_2 is False:
shoetypes.extend('gym shoes', 'running shoes')
elif gym is True:
shoetypes.append('gym shoes')
elif run is True:
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 is True:
misc_number = int_input("How many separate pairs of activity-specific shoes/boots does this involve?\n")
for _ in range(misc_number):
misc_shoes = input("Enter your name for one miscellaneous pair:\n")
shoetypes.append(misc_shoes)
result()
holiday()
```

Python