Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 8.91 KB | None | 0 0
  1. import sys
  2.  
  3. print("Welcome to a fun word replacement game.")
  4. try:
  5.     fileCheck = input("Enter the name of the file to use:\n")
  6.     fileBoi = open(fileCheck, 'r')
  7. except:
  8.     print("Error Bad File Name")
  9.     sys.exit(0)
  10. if fileCheck == 'example1.txt':
  11.     try:
  12.         checkName = input("Please give a name\n")
  13.     except:
  14.         if checkName == False:
  15.             print("Error Word Not Valid")
  16.             sys.exit(0)
  17.     try:
  18.         checkPlace = input("Please give a place\n")
  19.     except:
  20.         if checkPlace == False:
  21.             print("Error Word Not Valid")
  22.             sys.exit(0)
  23.     try:
  24.         checkDay = input("Please give a day of the week\n")
  25.     except:
  26.         if checkDay == False:
  27.             print("Error Word Not Valid")
  28.             sys.exit(0)
  29.     try:
  30.         checkTime = input("Please give a time\n")
  31.     except:
  32.         if checkTime == False:
  33.             print("Error Word Not Valid")
  34.             sys.exit(0)
  35.     try:
  36.         checkVerb = input("Please give a verb\n")
  37.     except:
  38.         if checkVerb == False:
  39.             print("Error Word Not Valid")
  40.             sys.exit(0)
  41.     try:
  42.         checkAnimal = input("Please give an animal\n")
  43.     except:
  44.         if checkAnimal == False:
  45.             print("Error Word Not Valid")
  46.             sys.exit(0)
  47.     try:
  48.         checkBodyPart = input("Please give a body part\n")
  49.     except:
  50.         if checkBodyPart == False:
  51.             print("Error Word Not Valid")
  52.             sys.exit(0)
  53.        
  54.     print("Here is your story:")
  55.     print("--------------------")
  56.     print("%s is having a party! It's going to be at %s on %s. Please make sure to show up at %s, or else you will be required to %s a/an %s with your %s." % (checkName, checkPlace, checkDay, checkTime, checkVerb, checkAnimal, checkBodyPart))
  57. else:
  58.     pass
  59.  
  60. ###just wanted to take this time to let the TA's know that they are beautiful :)###
  61.  
  62. if fileCheck == 'example2.txt':
  63.     try:
  64.         checkNounOne = input("Please give a noun\n")
  65.     except:
  66.         if checkNounOne == False:
  67.             print("Error Word Not Valid")
  68.             sys.exit(0)
  69.     try:
  70.         checkAdjOne = input("Please give an adjective\n")
  71.     except:
  72.         if checkAdjOne == False:
  73.             print("Error Word Not Valid")
  74.             sys.exit(0)
  75.     try:
  76.         checkNounTwo = input("Please give a noun\n")
  77.     except:
  78.         if checkNounTwo == False:
  79.             print("Error Word Not Valid")
  80.             sys.exit(0)
  81.     try:
  82.         checkNounThree = input("Please give a noun\n")
  83.     except:
  84.         if checkNounThree == False:
  85.             print("Error Word Not Valid")
  86.             sys.exit(0)
  87.     try:
  88.         checkAdjTwo = input("Please give an adjective\n")
  89.     except:
  90.         if checkAdjTwo == False:
  91.             print("Error Word Not Valid")
  92.             sys.exit(0)
  93.     try:
  94.         checkAdjThree = input("Please give an adjective\n")
  95.     except:
  96.         if checkAdjThree == False:
  97.             print("Error Word Not Valid")
  98.             sys.exit(0)
  99.     try:
  100.         checkAdjFour = input("Please give an adjective\n")
  101.     except:
  102.         if checkAdjectFour == False:
  103.             print("Error Word Not Valid")
  104.             sys.exit(0)
  105.     try:
  106.         checkNounFour = input("Please give a noun\n")
  107.     except:
  108.         if checkNounFour == False:
  109.             print("Error Word Not Valid")
  110.             sys.exit(0)
  111.     try:
  112.         checkNounFive = input("Please give a noun\n")
  113.     except:
  114.         if checkNounFive == False:
  115.             print("Error Word Not Valid")
  116.             sys.exit(0)
  117.     try:
  118.         checkAdjFive = input("Please give an adjective\n")
  119.     except:
  120.         if checkAdjectFive == False:
  121.             print("Error Word Not Valid")
  122.             sys.exit(0)
  123.     print("Here is your story:")
  124.     print("--------------------")
  125.     print("Weather plays an important part in our %s everyday. What is weather you ask? According to %s scientists, who are known as meteorologists, weather is what the %s is like at any time of the %s. It doesn't matter if the air is %s or %s, it's all weather. When vapors in %s clouds condense, we have %s and snow. A lot of %s means a %s snowstorm!" % (checkNounOne, checkAdjOne, checkNounTwo, checkNounThree, checkAdjTwo, checkAdjThree, checkAdjFour, checkNounFour, checkNounFive, checkAdjFive))
  126. else:
  127.     pass
  128.  
  129. ### another reminder that you are an amazing person C; ###
  130.  
  131. if fileCheck == 'mad_lib.txt':
  132.     try:
  133.         checkAdjOne = input("Please give an adjective\n")
  134.     except:
  135.         if checkAdjOne == False:
  136.             print("Error Word Not Valid")
  137.             sys.exit(0)
  138.     try:
  139.         checkAdjTwo = input("Please give an adjective\n")
  140.     except:
  141.         if checkAdjTwo == False:
  142.             print("Error Word Not Valid")
  143.             sys.exit(0)
  144.     try:
  145.         checkNounOne = input("Please give a noun\n")
  146.     except:
  147.         if checkNounOne == False:
  148.             print("Error Word Not Valid")
  149.             sys.exit(0)
  150.     try:
  151.         checkNounTwo = input("Please give a noun\n")
  152.     except:
  153.         if checkNounTwo == False:
  154.             print("Error Word Not Valid")
  155.             sys.exit(0)
  156.     try:
  157.         checkPluralOne = input("Please give a plural noun\n")
  158.     except:
  159.         if checkPluralOne == False:
  160.             print("Error Word Not Valid")
  161.             sys.exit(0)
  162.     try:
  163.         checkGame = input("Please give a game\n")
  164.     except:
  165.         if checkGame == False:
  166.             print("Error Word Not Valid")
  167.             sys.exit(0)
  168.     try:
  169.         checkPluralTwo = input("Please give a plural noun\n")
  170.     except:
  171.         if checkPluralTwo == False:
  172.             print("Error Word Not Valid")
  173.             sys.exit(0)
  174.     try:
  175.         checkVerbOne = input("Please give a verb ending in ing\n")
  176.     except:
  177.         if checkVerbOne == False:
  178.             print("Error Word Not Valid")
  179.             sys.exit(0)
  180.     try:
  181.         checkVerbTwo = input("Please give a verb ending in ing\n")
  182.     except:
  183.         if checkVerbTwo == False:
  184.             print("Error Word Not Valid")
  185.             sys.exit(0)
  186.     try:
  187.         checkPluralThree = input("Please give a plural noun\n")
  188.     except:
  189.         if checkPluralThree == False:
  190.             print("Error Word Not Valid")
  191.             sys.exit(0)
  192.     try:
  193.         checkVerbThree = input("Please give a verb ending in ing\n")
  194.     except:
  195.         if checkVerbThree == False:
  196.             print("Error Word Not Valid")
  197.             sys.exit(0)
  198.     try:
  199.         checkNounThree = input("Please give a noun\n")
  200.     except:
  201.         if checkNounThree == False:
  202.             print("Error Word Not Valid")
  203.             sys.exit(0)
  204.     try:
  205.         checkPlant = input("Please give a plant\n")
  206.     except:
  207.         if checkPlant == False:
  208.             print("Error Word Not Valid")
  209.             sys.exit(0)
  210.     try:
  211.         checkBody = input("Please give a part of the body\n")
  212.     except:
  213.         if checkBody == False:
  214.             print("Error Word Not Valid")
  215.             sys.exit(0)
  216.     try:
  217.         checkPlace = input("Please give a place\n")
  218.     except:
  219.         if checkPlace == False:
  220.             print("Error Word Not Valid")
  221.             sys.exit(0)
  222.     try:
  223.         checkVerbFour = input("Please give a verb ending in ing\n")
  224.     except:
  225.         if checkVerbFour== False:
  226.             print("Error Word Not Valid")
  227.             sys.exit(0)
  228.     try:
  229.         checkAdjThree = input("Please give an adjective\n")
  230.     except:
  231.         if checkAdjThree == False:
  232.             print("Error Word Not Valid")
  233.             sys.exit(0)
  234.     try:
  235.         checkNumber = input("Please give a number\n")
  236.     except:
  237.         if checkNumber == False:
  238.             print("Error Word Not Valid")
  239.             sys.exit(0)
  240.     try:
  241.         checkPluralFour = input("Please give a plural noun\n")
  242.     except:
  243.         if checkPluralFour == False:
  244.             print("Error Word Not Valid")
  245.             sys.exit(0)
  246.     print("Here is your story:")
  247.     print("--------------------")
  248.     print("A vacation is when you take a trip to some %s place with your %s family. Usually you go to some place that is near a/an %s or up on a/an %s. A good vacation place is one where you can ride %s or play %s or go hunting for %s. I like to spend my time %s or %s. When parent go on a vacation, they spend their time eating three %s a day, and fathers play golf, and mothers sit around %s. Last summer, my little brother fell in a/an %s and got poison %s all over his %s. My family is going to go to (the) %s, and I will practice %s. Parents need vacations more than kids because parents are always very %s and because they have to work %s hours every day all year making enough %s to pay for the vacation." % (checkAdjOne, checkAdjTwo, checkNounOne, checkNounTwo, checkPluralOne, checkGame, checkPluralTwo, checkVerbOne, checkVerbTwo, checkPluralThree, checkVerbThree, checkNounThree, checkPlant, checkBody, checkPlace, checkVerbFour, checkAdjThree, checkNumber, checkPluralFour))
  249. else:
  250.     pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement