Using the script story.py as an example and possible starting point, write a script that generates a story using multiple levels of function calls that mirror the structure of your story.
Your script must have the following requirements:
script story.py:
# Sample story for assignment 6
import random
def create_whole_story(hero_name):
intro = create_intro(hero_name)
conflict = create_conflict(hero_name)
resolution = create_resolution(hero_name)
return intro + conflict + resolution
def create_intro(hero):
return hero + " lived in a land not too far away.\n"
def create_conflict(hero):
demise = random.choice(["ring of fire", "tarry pit", "dark
abyss"])
return "Alas! {} fell into a {}.\n".format(hero, demise)
def create_resolution(name):
fate = random.choice(["lives", "dies"])
if fate == "lives":
return "Fortunately, wandering shepards came by and saved
{}.".format(name)
else:
return "Sadly, that was the last we saw of {}.".format(name)
hero = input("What is the hero's name? ")
print("Here's your story...")
print(create_whole_story(hero))
# Sample story for assignment 6
import random
def create_whole_story(hero_name):
intro = create_intro(hero_name)
conflict = create_conflict(hero_name)
resolution = create_resolution(hero_name)
return intro + conflict + resolution
def create_intro(hero):
return hero + " was the strongest of all Vikings.
"+create_intro2()
def create_conflict(hero):
demise = random.choice(["ferocious dragon", "dragon hunter", "group
of invaders"])
return "While flying with his dragon, {} was attacked by a
{}.\n".format(hero, demise)
def create_resolution(name):
fate = random.choice(["lives", "dies"])
if fate == "lives":
return "Fortunately, wandering Vikings came by and supported {} in
the fight.".format(name)
else:
return "Sadly, his dragon was lost in the fight.".format(name)
def create_intro2():
return "He had a dragon named Thunder.\n"
hero = input("What is the hero's name? ")
print("Here's your story...")
print(create_whole_story(hero))
Using the script story.py as an example and possible starting point, write a script that generates a story using multiple levels of function calls that mirror the structure of your story. Your script...
In Python and in one file please. (Simple functions with an expressions) Create a function called load_inventory(filename). The filename argument in this case specifies the name of a file that contains all the inventory/product information for the store, including product names, descriptions, prices, and stock levels. This function should clear any information already in the product list (i.e., a fresh start) and then re-initialize the product list using the file specified by the filename argument. You can structure your file...
In Python and in one file please. (Simple functions with an expressions) Create a function called load_inventory(filename). The filename argument in this case specifies the name of a file that contains all the inventory/product information for the store, including product names, descriptions, prices, and stock levels. This function should clear any information already in the product list (i.e., a fresh start) and then re-initialize the product list using the file specified by the filename argument. You can structure your file...
Read “Instituionalizing our Demise: America vs Multiculturalism” by Roger Kimball on pg 268 and “Reinventing America” Call for a new national indentity” by Elizabeth Martinez on pg 275. Create a double entry notebook for each reading selection It should be atleast five observation and responses. wric 268 PART 2 essay pro. exactly how and why their authors disagree. Instead of with parties in conflict as mediators do, you will nt of view designed to appeal to both sides, mediatn posing...