In [ ]:
#Create your own version of the Mayoral Excuse Machine in Python that takes in a
#name and location, selects an excuse at random and prints an excuse
#(“Sorry, Richard, I was late to City Hall to meet you,
#I had a very rough night and woke up sluggish”)
#Use the “excuses.csv” in the Github repository
#Extra credit if you print the link to the story as well
In [56]:
#Import the things I need
import pandas as pd
import random
#Get the inputs from the user
name = input("What's your name? ")
location = input("What's your location?")
#Read in the csv file
df = pd.read_csv('excuse.csv')
In [23]:
#What are the columns?
df.columns
Out[23]:
In [72]:
random_excuse = random.choice(df['excuse'])
print("Sorry,", name,"I was late to", location, "to meet you,", random_excuse)
In [ ]:
In [ ]:
In [ ]: