Can this program run?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Can this program run?

def townSquare():
print("You're in Town Square.")
print("Type 'Northeast' or 'NE' to go to Town Hall")
print("Type 'South' or 'S' to go to the Town Archives")
print("Type 'Southeast' or 'SE' to go to the Trading Post")
nextRoom = ""#start_copying here
while(nextRoom ""):
user Input input("Player choice: ").upper()
"NORTHEAST" or userInput
if(user Input
nextRoom = "Town Hall"
elif(user Input
nextRoom =
elif(user Input
else:
nextRoom "Trading Post"
print (nextRoom) #end copy here
print("Command unrecognize.")
else:
def tradingPost():
print("Welcome! You're in the Trading Post,") #printing out the options
print("You found a key.")
print("type 'Northwest' or 'NW' to go to Town Square.")
nextRoom =
'#start_ copying here
while(nextRoom
""):
user Input input("Player choice: ").upper() #creating user input
if (userInput =="NORTHWEST" or userInput
nextRoom
"Town Square" #destination
|| ||
else:
print("Command unrecognize.")
print (nextRoom) #end copy here
# programming the Secret Room
def secretRoom():
print(nextRoom)
else:
while(nextRoom ""):
user Input
input("Player choice: ").upper()
if(userInput=="NORTH" or userInput=="N"):
nextRoom =
"Study"
print("Welcome! You're in the Secret Room.")
print("Go to the Study and type Pull Book.")
print("Type 'North' or 'N' to go to the Study.")
nextRoom =
print("Command unrecognize.")
||||
while(nextRoom
# programming the town archives
def townArchives():
print("Welcome! You're in the Town Archives.")
print("Type 'South' or 'S' to go to the Study.")
nextRoom =
while(nextRoom
""):
user Input input("Player choice: ").upper()
if(userInput=="SOUTH" or userInput=="S"):
nextRoom "Study"
print(nextRoom)
# programming the garden
def garden():
else:
Game.")
nextRoom
print("Command unrecognize.")
print (nextRoom)
print("Welcome! You're in the Garden.")
print("Type 'West' or 'W' to go to the Dead End and return to Car Ride or
'Southeast' or 'SE' to return to Town Square.")
nextRoom
=
while(nextRoom
user Input input("Player choice: ").upper()
if(userInput=="WEST" or userInput=="W"):
nextRoom
"Car Ride"
nextRoom
|| ||
print("Winner!")
==
elif(userInput=="SOUTHEAST" or userInput=="SE"):
"Town Square"
nextRoom
# programming the end room
def endRoom():
print("Command unrecognize.")
else:
main()
userInput
print (nextRoom)
# programming the cult chambers
def cultChambers():
print("Welcome! You're in the Cult Chambers.")
print("Type 'East' or 'E' to go to the Dead End or 'South' or 'S' to End
==
|| ||
else:
"Town Archives"
"SOUTHEAST" or userInput "SE"):
print (nextRoom)
==
nextRoom
=
input("Player choice: ").upper()
if(userInput=="EAST" or userInput=="E"):
print("Dead End")
|| ||
while(nextRoom
elif(userInput=="SOUTH" or userInput=="S"):
"End Room"
print("Command unrecognize.")
# programming the under ground cave
def underGroundCave():
else:
==
""):
print("Welcome! You're in the Under Ground Cave.")
print("Type 'South' or 'S' to go to the Cult Chambers")
nextRoom =
while(nextRoom
user Input
|| ||
"SOUTH" or userInput "S"):
else:
==
input("Player choice: ").upper()
if(userInput=="SOUTH" or userInput=="S"):
nextRoom =
"Cult Chambers"
print("Command unrecognize.")
# programming the study
def study():
=
=
nextRoom
while (nextRoom
user Input
11 11
=
""):
print("Welcome! You're in the Study.")
print("Type 'Pull Book' or 'PB' to go to the Underground Cave")
else:
==
print (nextRoom)
=
|| ||
=
nextRoom "Car Ride"
print(nextRoom)
# programming the mansion
def mansion():
user Input input("Player choice: ").upper()
if(userInput=="PULL_BOOK" or userInput=="PB"):
nextRoom "Underground Cave"
==
else:
""):
print (nextRoom)
print("Welcome! You're in Mansion.")
print("Type 'West' or 'W' to go to the Garden")
print("Type 'North' or 'N' to go to the Study")
print("Type 'Key' or 'K' to enter the Secret Room.")
#main program
def main():
==
""):
"NE"):
input("Player choice: ").upper()
if(userInput=="WEST" or userInput=="W"):
nextRoom = "Garden"
elif(userInput=="NORTH" or userInput=="N"):
nextRoom "Study"
print("Command unrecognize.")
print(nextRoom)
# programming the town hall
def townHall():
elif(userInput=="KEY" or userInput=="K"):
nextRoom "Secret Room"
""):
print("Welcome! You're in the Town Hall.")
print("Type 'West' or 'W' to go to the Mansion.")
nextRoom =
while (nextRoom
user Input
"NW"):
print("Command unrecognize.")
input("Player choice: ").upper()
if(userInput=="WEST" _or_userInput=="W"):
nextRoom "Mansion"
# programming the car ride
def carRide():
""):
=
print("Type 'West' or 'W' to go to the Town Square else South/S, North/N/ or
West/W for random location.")
nextRoom =
while(nextRoom
user Input
""):
input("Player choice: ")
if(userInput=="WEST" or userInput=="W"):
nextRoom "Town Square"
elif(user Input=="SOUTH" or userInput=="S"):
nextRoom "Trading Post"
elif(userInput=="NORTH" or userInput=="N"):
nextRoom "Garden"
elif(userInput=="WEST" or userInput=="W"):
nextRoom "Underground Cave"
print("Command unrecognize.")
room = carRide ()
elif (room=="Town Square"):
room = town Square ()
elif(room=="Trading Post"):
room = tradingPost()
elif(room=="Garden"):
room = garden ()
elif(room=="Underground_Cave"):
room = "Car Ride" # starting room
print("You.re in a car. The town of Loveheaven is ahead. Can you escape?")
# Loop till game ends. It is an infinite Loop.
while(nextRoom
""):
if(room=="Car Ride"):
room = underGroundCave()
elif(room=="Town Hall"):
room = townHall()
elif (room=="Town Archives"):
room = townArchives()
elif (room=="Secret Room"):
room = secretRoom()
elif (room=="End_Room"):
room = endRoom ()
elif (room=="Cult Chambers"):
room = cultChambers()
elif (room=="Study"):
study ( )
elif(room=="Mansion"):
room = mansion ()
room =
Transcribed Image Text:def townSquare(): print("You're in Town Square.") print("Type 'Northeast' or 'NE' to go to Town Hall") print("Type 'South' or 'S' to go to the Town Archives") print("Type 'Southeast' or 'SE' to go to the Trading Post") nextRoom = ""#start_copying here while(nextRoom ""): user Input input("Player choice: ").upper() "NORTHEAST" or userInput if(user Input nextRoom = "Town Hall" elif(user Input nextRoom = elif(user Input else: nextRoom "Trading Post" print (nextRoom) #end copy here print("Command unrecognize.") else: def tradingPost(): print("Welcome! You're in the Trading Post,") #printing out the options print("You found a key.") print("type 'Northwest' or 'NW' to go to Town Square.") nextRoom = '#start_ copying here while(nextRoom ""): user Input input("Player choice: ").upper() #creating user input if (userInput =="NORTHWEST" or userInput nextRoom "Town Square" #destination || || else: print("Command unrecognize.") print (nextRoom) #end copy here # programming the Secret Room def secretRoom(): print(nextRoom) else: while(nextRoom ""): user Input input("Player choice: ").upper() if(userInput=="NORTH" or userInput=="N"): nextRoom = "Study" print("Welcome! You're in the Secret Room.") print("Go to the Study and type Pull Book.") print("Type 'North' or 'N' to go to the Study.") nextRoom = print("Command unrecognize.") |||| while(nextRoom # programming the town archives def townArchives(): print("Welcome! You're in the Town Archives.") print("Type 'South' or 'S' to go to the Study.") nextRoom = while(nextRoom ""): user Input input("Player choice: ").upper() if(userInput=="SOUTH" or userInput=="S"): nextRoom "Study" print(nextRoom) # programming the garden def garden(): else: Game.") nextRoom print("Command unrecognize.") print (nextRoom) print("Welcome! You're in the Garden.") print("Type 'West' or 'W' to go to the Dead End and return to Car Ride or 'Southeast' or 'SE' to return to Town Square.") nextRoom = while(nextRoom user Input input("Player choice: ").upper() if(userInput=="WEST" or userInput=="W"): nextRoom "Car Ride" nextRoom || || print("Winner!") == elif(userInput=="SOUTHEAST" or userInput=="SE"): "Town Square" nextRoom # programming the end room def endRoom(): print("Command unrecognize.") else: main() userInput print (nextRoom) # programming the cult chambers def cultChambers(): print("Welcome! You're in the Cult Chambers.") print("Type 'East' or 'E' to go to the Dead End or 'South' or 'S' to End == || || else: "Town Archives" "SOUTHEAST" or userInput "SE"): print (nextRoom) == nextRoom = input("Player choice: ").upper() if(userInput=="EAST" or userInput=="E"): print("Dead End") || || while(nextRoom elif(userInput=="SOUTH" or userInput=="S"): "End Room" print("Command unrecognize.") # programming the under ground cave def underGroundCave(): else: == ""): print("Welcome! You're in the Under Ground Cave.") print("Type 'South' or 'S' to go to the Cult Chambers") nextRoom = while(nextRoom user Input || || "SOUTH" or userInput "S"): else: == input("Player choice: ").upper() if(userInput=="SOUTH" or userInput=="S"): nextRoom = "Cult Chambers" print("Command unrecognize.") # programming the study def study(): = = nextRoom while (nextRoom user Input 11 11 = ""): print("Welcome! You're in the Study.") print("Type 'Pull Book' or 'PB' to go to the Underground Cave") else: == print (nextRoom) = || || = nextRoom "Car Ride" print(nextRoom) # programming the mansion def mansion(): user Input input("Player choice: ").upper() if(userInput=="PULL_BOOK" or userInput=="PB"): nextRoom "Underground Cave" == else: ""): print (nextRoom) print("Welcome! You're in Mansion.") print("Type 'West' or 'W' to go to the Garden") print("Type 'North' or 'N' to go to the Study") print("Type 'Key' or 'K' to enter the Secret Room.") #main program def main(): == ""): "NE"): input("Player choice: ").upper() if(userInput=="WEST" or userInput=="W"): nextRoom = "Garden" elif(userInput=="NORTH" or userInput=="N"): nextRoom "Study" print("Command unrecognize.") print(nextRoom) # programming the town hall def townHall(): elif(userInput=="KEY" or userInput=="K"): nextRoom "Secret Room" ""): print("Welcome! You're in the Town Hall.") print("Type 'West' or 'W' to go to the Mansion.") nextRoom = while (nextRoom user Input "NW"): print("Command unrecognize.") input("Player choice: ").upper() if(userInput=="WEST" _or_userInput=="W"): nextRoom "Mansion" # programming the car ride def carRide(): ""): = print("Type 'West' or 'W' to go to the Town Square else South/S, North/N/ or West/W for random location.") nextRoom = while(nextRoom user Input ""): input("Player choice: ") if(userInput=="WEST" or userInput=="W"): nextRoom "Town Square" elif(user Input=="SOUTH" or userInput=="S"): nextRoom "Trading Post" elif(userInput=="NORTH" or userInput=="N"): nextRoom "Garden" elif(userInput=="WEST" or userInput=="W"): nextRoom "Underground Cave" print("Command unrecognize.") room = carRide () elif (room=="Town Square"): room = town Square () elif(room=="Trading Post"): room = tradingPost() elif(room=="Garden"): room = garden () elif(room=="Underground_Cave"): room = "Car Ride" # starting room print("You.re in a car. The town of Loveheaven is ahead. Can you escape?") # Loop till game ends. It is an infinite Loop. while(nextRoom ""): if(room=="Car Ride"): room = underGroundCave() elif(room=="Town Hall"): room = townHall() elif (room=="Town Archives"): room = townArchives() elif (room=="Secret Room"): room = secretRoom() elif (room=="End_Room"): room = endRoom () elif (room=="Cult Chambers"): room = cultChambers() elif (room=="Study"): study ( ) elif(room=="Mansion"): room = mansion () room =
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Hiring Problem
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education