Use the “excuses.csv” in the Github repository Extra credit if you print the link to the story as well
In [6]:
import pandas as pd
import random
In [5]:
df = pd.read_csv("excuse.csv")
df
Out[5]:
In [35]:
random.choice(df['excuse'])
Out[35]:
In [36]:
def excuse_generator(name,location):
#print("entered loop")
name= name
location= location
return "Sorry"+ " " + name +" " + "I was late to"+ " " + location + " "+ "to meet you"+ " "+ random.choice(df['excuse'])
In [37]:
excuse_generator('Mercy','School')
Out[37]:
In [38]:
pick_name= input("Choose a name")
pick_location= input("Choose a location")
In [39]:
excuse_generator(pick_name,pick_location)
Out[39]:
In [ ]: