Advertisement
Guest User

Project 1

a guest
Apr 7th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 13.67 KB | None | 0 0
  1. import random
  2. import math
  3. import time
  4.  
  5. def boot(): #This is the intitial screen when you run the program. It is just a few print statements.
  6.   print """         _____________ _____________
  7.        |             |             |
  8.        |             |             |
  9.        |             |             |
  10.        |             |             |
  11.        |             |             |
  12.        |_____________|_____________|
  13.        |             |             |
  14.        |             |             |
  15.        |             |             |
  16.        |             |             |
  17.        |             |             |
  18.        |_____________|_____________|
  19.        
  20.  
  21.  
  22.             Welcome to Windows.
  23.  
  24. Please wait while we check your peripherals..."""
  25.  
  26. def username(): #This is where you input the username and password. If you do not get it right it will ask if you want a hint and it will tell you the right username and password.
  27.   uname = raw_input("Username:")
  28.   password = raw_input("Password:")
  29.   if uname == "stpetersprep" and password == "password":
  30.     print "Logging in..."
  31.     main_system()
  32.   else:
  33.     hint = raw_input("That was incorrect. Do you need a hint?")
  34.     if hint == "yes" or hint == "Yes":
  35.       print "'stpetersprep' is the username and 'password' is the password"
  36.       username()
  37.     elif hint == "no" or hint == "No":
  38.       tryagain = raw_input("Would you like to try again?")
  39.       if tryagain == "yes" or tryagain == "Yes":
  40.         username()
  41.       else:
  42.         restart2 = raw_input("Would you like to restart?")
  43.     elif restart2 == "Yes" or restart2 == "yes":
  44.       boot()
  45.       peripherals()
  46.     else:
  47.       print "Shutting down..."
  48.  
  49. def documents(): # This will let you open documents and read them.
  50.     print """
  51.    1. Short Story
  52.    2. Poem
  53.    3. Funny Joke
  54.    
  55.    9. Exit"""
  56.     document_choice = int(raw_input("Input your choice."))
  57.     if document_choice == 1:
  58.       print "\nThe quick brown fox jumped over the lazy dog."
  59.       short_story = int(raw_input("\nInput '9' when you are done reading."))
  60.       if short_story == 9:
  61.         documents()
  62.     elif document_choice == 2:
  63.       print """\nLove is like an endless mystery,
  64.      for it has nothing else to explain it."""
  65.       poem_choice = int(raw_input("\nInput '9' when you are done being inspired."))
  66.       if poem_choice == 9:
  67.         documents()
  68.     elif document_choice == 3:
  69.       print """\nWhat do you call a dinosaur with an extensive vocabulary?
  70.      
  71.      A thesaurus!"""
  72.       joke_choice = int(raw_input("\nWhen you are done laughing, input '9' to exit."))
  73.       if joke_choice == 9:
  74.         documents()
  75.    
  76.     elif document_choice == 9:
  77.       main_system()
  78.      
  79. def pictures(): # This will display some text pictures.
  80.   print """
  81.  1. Dinosaur
  82.  2. Elephant
  83.  3. Camel
  84.  
  85.  9. Exit"""
  86.   picture_choice = int(raw_input("Input your choice."))
  87.   if picture_choice == 1:
  88.     print """
  89.  ░▄▄▄▄░
  90.  ▀▀▄██►
  91.  ▀▀███►
  92.  ░▀███►░█►
  93.  ▒▄████▀▀"""
  94.     dinosaur_end = int(raw_input("\nInput '9' when you are done marvelling at this magnificent creature."))
  95.     if dinosaur_end == 9:
  96.       pictures()
  97.   elif picture_choice == 2:
  98.     print """
  99.    ──███▅▄▄▄▄▄▄▄▄▄
  100.    ─██▐████████████
  101.    ▐█▀████████████▌▌
  102.    ▐─▀▀▀▐█▌▀▀███▀█─▌
  103.    ▐▄───▄█───▄█▌▄█"""
  104.     elephant_end = int(raw_input("\nInput '9' when you are done being amazed by this beautiful specimen."))
  105.     if elephant_end == 9:
  106.       pictures()
  107.   elif picture_choice == 3:
  108.     print  """
  109.    ───▄██▄─██▄───▄
  110.    ─▄██████████▄███▄
  111.    ─▌████████████▌
  112.    ▐▐█░█▌░▀████▀░░
  113.    ░▐▄▐▄░░░▐▄▐▄░░░░"""
  114.     camel_end = int(raw_input("\nInput '9' after you realize that this is not as good as the other two."))
  115.     if camel_end == 9:
  116.       pictures()
  117.   elif picture_choice == 9:
  118.     main_system()
  119.  
  120. def Do_Now(): # This is a simple math formula with a for loop.
  121.   number = raw_input("Input your favorite number.")
  122.   number = int(number)
  123.   for num in range(1,11):
  124.     print math.pow(number,num), "\n is your favorite number to the", num, "power"
  125.     continue
  126.  
  127. def plane_game(): # This is a text based game.
  128.   print """You are flying a plane and you see another plane coming at you. You must make a quick decision about which direction to go? You can go up, down, left or right."""
  129.   print "-"*53
  130.   choice=raw_input('Which direction do you go?')
  131.   if choice == "Up" or choice == "up":
  132.     print "You stalling now...\nYou played yourself."
  133.     print "-" * 53
  134.     play_again = raw_input("Do you want to play again?")
  135.     if play_again == "Yes" or play_again == "yes":
  136.       print "-" * 53
  137.       plane_game()
  138.     elif play_again == "No" or play_again == "no":
  139.       exit
  140.   elif choice == "Down" or choice == "down":
  141.     print "You narrowly lived.\nYou Win!"
  142.     print "-" * 53
  143.     exit
  144.   elif choice == "Left" or choice == "left":
  145.     print "You are super dead because you went head on."
  146.     print "-" * 53
  147.     play_again = raw_input("Do you want to play again?")
  148.     if play_again == "Yes" or play_again == "yes":
  149.       print "-" * 53
  150.       plane_game()
  151.     elif play_again == "No" or play_again == "no":
  152.       exit
  153.   elif choice == "Right" or choice == "right":
  154.     print "You clipped each other and now you are plummiting into the ground."
  155.     print "-" * 53
  156.     play_again = raw_input("Do you want to play again?")
  157.     if play_again == "Yes" or play_again == "yes":
  158.       print "-" * 53
  159.       plane_game()
  160.     elif play_again == "No" or play_again == "no":
  161.       exit
  162.   else:
  163.     print "That was not a valid direction."
  164.     print "-" * 53
  165.     play_again = raw_input("Do you want to play again?")
  166.     if play_again == "Yes" or play_again == "yes":
  167.       print "-" * 53
  168.       plane_game()
  169.     elif play_again == "No" or play_again == "no":
  170.       exit
  171.  
  172. def lunch(): # This is the student life program that uses if statements to tell you what you can get for lunch.
  173.   money0 = "I hope you brought a lunch."
  174.   money1 = "You can get a muffin or something.\n\n"
  175.   money2 = "You can get one slice of pizza at Lisbon's for 2 dollars\n\n"
  176.   money3 = "You can get a Taylor Ham, Egg and Cheese or Bacon Egg and Cheese at Gotham for 3 dollars. No drink tho.\n\n"
  177.   money4 = "You can get two slices of pizza at Lisbon's. Also, you can get a Taylor Ham, Egg and Cheese at Legal Ground (much better than the commons) for 4 dollars.\n\n"
  178.   money5 = "You can get a student special at Lisbon's (two slices of pizza and a drink) or you can get a Cheesesteak and a water at Gotham for 5 dollars.\n\n"
  179.   money6 = "You can get a Cheeseburger Deluxe at Gotham with a bottle of water or you can also get many of the sandwiches at Gotham. Also, you can get 2 Sicilian Slices at Lisbon's for 6 dollars.\n\n"
  180.   money7 = "You can get a Chicken Parm Sandwich at Milano's (Try it spicy)for $6.25.\n\n"
  181.   money10 = "If it's friday you can get Calamari over Spaghetti at Milano's for $9.25. If it's not friday just get one of the other things.\n\n"
  182.  
  183.   money = raw_input("How much money (in dollars) do you have in your wallet?")
  184.   money = float(money)
  185.   if money <= 0:
  186.     print money0
  187.   elif money <= 1.99:
  188.     print money1, "You need more money, bro."
  189.   elif money <= 2:
  190.     print money1, "or", money2
  191.   elif money <= 3:
  192.     print money1, "or", money2, "or", money3
  193.   elif money <= 4:
  194.     print money1, "or", money2, "or", money3, "or", money4
  195.   elif money <= 5:
  196.     print money1, "or", money2, "or", money3, "or", money4, "or", money5
  197.   elif money <= 6:
  198.     print money1, "or", money2, "or", money3, "or", money4, "or", money5, "or", money6
  199.   elif money <= 6.25:
  200.     print money1, "or", money2, "or", money3, "or", money4, "or", money5, "or", money6, "or", money7
  201.   elif money <= 9.25:
  202.     print money10, money1, "or", money2, "or", money3, "or", money4, "or", money5, "or", money6, "or", money7
  203.   elif money <= 99999999999999999999999999999999999999999999999999999999999999999:
  204.     print "You are just balling out, dude. Go get two lunches or something."
  205.    
  206. def growth(): # This is a simple input and output with a math equation for exponential growth.
  207.   initial_population = float(raw_input("Input the Principle"))
  208.   rate_of_growth = float(raw_input("Input the rate of growth"))
  209.   for num in range(1,27):
  210.     print "The value after", num, "years is", initial_population*math.e**(rate_of_growth*num)
  211.  
  212. def games(): #This opens a menu for games.
  213.   print """
  214.  
  215.  1. Plane Game
  216.  2. Favorite Number Game
  217.  
  218.  9. Exit"""
  219.   game_choice = int(raw_input("Input your choice."))
  220.   if game_choice == 1:
  221.     plane_game()
  222.     plane_choice = int(raw_input("\nInput '1' if you want to play again. Input '9' to exit"))
  223.     if plane_choice == 1:
  224.       plane_game()
  225.     if plane_choice == 9:
  226.       games()
  227.   elif game_choice == 2:
  228.     Do_Now()
  229.     donow_choice = int(raw_input("\n Input '1' if you want to play again. Input '9' to exit."))
  230.     if donow_choice == 1:
  231.       Do_Now()
  232.     elif donow_choice == 9:
  233.       games()
  234.   elif game_choice == 9:
  235.     main_system()
  236.  
  237. def tools(): # This opens a menu for tools.
  238.   print """
  239.  
  240.  1. Lunch
  241.  2. Exponential Growth
  242.  
  243.  9. Exit"""
  244.   tools_choice = int(raw_input("Input your choice."))
  245.   if tools_choice == 1:
  246.     lunch()
  247.     lunch_choice = float(raw_input("\nInput '9' to exit."))
  248.     if lunch_choice == 9:
  249.       tools()
  250.   elif tools_choice == 2:
  251.     growth()
  252.     growth_choice = float(raw_input("\nInput '9' to exit."))
  253.     if growth_choice == 9:
  254.       tools()
  255.   elif tools_choice == 9:
  256.     main_system()
  257.  
  258. def task_manager(): # This shows you the tasks that are running and allows you to remove tasks from the list.
  259.   tasks = ["Google Chrome", "CS:GO", "Photoshop", "Discord"]
  260.   print """
  261.  These are the programs that are running:
  262.  
  263.  1. Google Chrome
  264.  2. CS:GO
  265.  3. Photoshop
  266.  4. Discord"""
  267.   task_manager_question = int(raw_input("\nWhich program would you like to close? Input '9' to close all programs."))
  268.   if task_manager_question == 1:
  269.     tasks.pop(0)
  270.     print "\nNow these tasks are open", tasks
  271.     tasks_1 = int(raw_input("Input '9' to go back to the main menu."))
  272.     if tasks_1 == 9:
  273.       main_system()
  274.   elif task_manager_question == 2:
  275.     tasks.pop(1)
  276.     print "\nNow these tasks are open", tasks
  277.     tasks_2 = int(raw_input("Input '9' to go back to the main menu."))
  278.     if tasks_2 == 9:
  279.       main_system()
  280.   elif task_manager_question == 3:
  281.     tasks.pop(2)
  282.     print "\nNow these tasks are open", tasks
  283.     tasks_3 = int(raw_input("Input '9' to go back to the main menu."))
  284.     if tasks_3 == 9:
  285.       main_system()
  286.   elif task_manager_question == 4:
  287.     tasks.pop(3)
  288.     print "\nNow these tasks are open", tasks
  289.     tasks_3 = int(raw_input("Input '9' to go back to the main menu."))
  290.     if tasks_3 == 9:
  291.       main_system()
  292.   elif task_manager_question == 9:
  293.     print "\nNow you have no tasks open"
  294.     tasks_9 = int(raw_input("Input '9' to go back to the main menu."))
  295.     if tasks_9 == 9:
  296.       main_system()
  297.  
  298. def power_options(): # This is a power options menu which will bring you to different functions.
  299.   print """
  300.  
  301.  1. Log Off
  302.  2. Restart
  303.  3. Shut Down
  304.  
  305.  9. Exit"""
  306.   power_choice = int(raw_input("Input your choice."))
  307.   if power_choice == 1:
  308.     username()
  309.   elif power_choice == 2:
  310.     boot()
  311.     peripherals()
  312.   elif power_choice == 3:
  313.     print "Shutting down..."
  314.     quit
  315.   elif power_choice == 9:
  316.     main_system()
  317.  
  318.  
  319.  
  320. def main_system(): # This is the main system which gives you a menu which lets you open other menus.
  321.   print """\nWelcome back, 'stpetersprep'.
  322.  
  323.  1. Documents
  324.  2. Pictures
  325.  3. Games
  326.  4. Tools
  327.  5. Task Manager
  328.  
  329.  9. Power Options"""
  330.   options = int(raw_input("Input your choice."))
  331.   if options == 1:
  332.     documents()
  333.   if options == 2:
  334.     pictures()
  335.   if options == 3:
  336.     games()
  337.   if options == 4:
  338.     tools()
  339.   if options == 5:
  340.     task_manager()
  341.   if options == 9:
  342.     power_options()
  343.  
  344. boot()
  345.  
  346. print "\n", "=" *54
  347.  
  348. def peripherals(): # This is where the system checks for your peripherals. It uses the random module to randomly see if your mouse, keybaord and monitor are connected. This uses the time module to display some of the print statements shortly after one another.
  349.   mouse = random.randint(1, 11)
  350.   if mouse <= 8:
  351.     mouse = 1
  352.     time.sleep(1)
  353.     print "\nMouse: %s" % "Connected"
  354.   else:
  355.     mouse = 2
  356.     time.sleep(1)
  357.     print "\nMouse: %s" % "Disconnected"
  358.   keyboard = random.randint(1,11)
  359.   if keyboard <= 8:
  360.     keyboard = 1
  361.     time.sleep(1)
  362.     print "\nKeyboard: %s" % "Connected"
  363.   else:
  364.     keyboard = 2
  365.     time.sleep(1)
  366.     print "\nKeyboard: %s" % "Disconnected"
  367.   monitor = random.randint(1, 11)
  368.   if monitor <= 9:
  369.     monitor = 1
  370.     time.sleep(1)
  371.     print "\nMonitor %s\n" % "Connected"
  372.   else:
  373.     monitor = 2
  374.     time.sleep(1)
  375.     print "\nMonitor not connected.\n \nYou can't even see this right now.\n"
  376.    
  377.   if mouse == 1 and keyboard == 1 and monitor == 1:
  378.     print "Your peripherals are connected... Please enter your username and password\n"
  379.     username()
  380.   elif mouse == 2 or keyboard == 2 or monitor == 2:
  381.     print "Your peripherals are not connected, please restart.\n"
  382.     restart = raw_input("Would you like to restart?")
  383.     if restart == "Yes" or restart == "yes":
  384.       print "\n" * 5
  385.       boot()
  386.       peripherals()
  387.     else:
  388.       print "Shutting down..."
  389.        
  390. peripherals()
  391.  
  392. # I did this whole thing Angus did a seperate one.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement