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')


What's your name? Georgia
What's your location?Kromrei

In [23]:
#What are the columns?
df.columns


Out[23]:
Index(['excuse', 'headline', 'hyperlink'], dtype='object')

In [72]:
random_excuse = random.choice(df['excuse'])
print("Sorry,", name,"I was late to", location, "to meet you,", random_excuse)


Sorry, Georgia I was late to Kromrei to meet you, I was just not feeling well this morning

In [ ]:


In [ ]:


In [ ]: