Advertisement
Guest User

python end of unit assessment

a guest
Dec 12th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.68 KB | None | 0 0
  1. #santa naughty list
  2. import time
  3. import random
  4. def presents():
  5.     present_list = ["red toy car", "blue toy car", "green toy car", "purple toy car", "aqua toy car", "pink toy speed boat", "red toy speed boat", "blue toy speed boat", "iphone xs red", "iphone xs grey", "iphone xs blue", "£10,000"] #list of random presents
  6.     secure_random = random.SystemRandom() #casts secure_random as .SystemRandom
  7.     present = secure_random.choice(present_list) #sets present as a random choice
  8.     print ("the elves have found a present for you....", present) #randomly chooses a present from present_list
  9.  
  10.    #also i would like to imform you that code for presents was fullly mine and others, you can see who did, copied my code by begging me to send it
  11.    
  12.    
  13. def questions():
  14.     global nice #makes code nice
  15.     q1 = input(user+", if you found a £10, would you: \n A: keep the money for what ever you want \n B: give the money to the homeless man or buy food for him with the money \n C: show off  to him that you found a £10 note on the floor and its yours \n")
  16.     #make input lower case
  17.     if q1 == "a":
  18.         nice =nice-1 #takes 1 away from nice
  19.         print("that is not the best thing to do, you should really give him the money")
  20.     elif q1 == "b":
  21.         nice =nice+1 #adds 1 to nice
  22.         print("that is the right thing to do, well done")
  23.     elif q1 == "c":
  24.         nice =nice-2 #takes 2 away from nice
  25.         print("that is a horrible thing to do, why would you do that?!")
  26.     else:
  27.         print("you did not pick one of the options, which is bad as you are not listening to santas instructions")
  28.         n=-1
  29.     time.sleep(1)
  30.     print("next questions...")
  31.     q2 = input(user+", if someone was sad in your school, would you: \n A: ignore them and carry on \n B: comfort them and ask how they are \n C: laugh at them and make fun of them")
  32.     if  q2 == "a":
  33.         nice =nice-1
  34.     if q2 == "b":
  35.         nice=nice+1
  36.     if q2 == "c":
  37.         nice =nice-2
  38.     print("next question...")
  39.     time.sleep(1)
  40.     q3 = input(user+", is christmas about: \n A: getting presents and money \n B: spending time with your family \n C: flexing to people who are not as fortunate as you?")
  41.     if q3 == "a":
  42.             nice =nice-1
  43.     if q3 == "b":
  44.             nice =nice+1
  45.     if q3 == "c":
  46.             nice =nice-2
  47.     print("checking data") #checks data
  48.     print(nice)
  49.     time.sleep(1) #delays 1 second
  50.     list = open("list.txt","a")
  51.     if nice >= 2:
  52.             good = "y"
  53.             presents()
  54.             Line = user + ": " + "nice \n" #puts the user and nice and new line
  55.             list.write(Line)
  56.             list.close()
  57.            
  58.     if nice < 2:
  59.             good = "n"
  60.             Line =  user + ": " + "bad  \n" #purs the user and bad and new line
  61.             list.write(Line)
  62.             list.close()
  63.    
  64.    
  65. def start():
  66.     global user
  67.     global nice
  68.     number = input("How many children are filling this questionare this session? Please enter the answer as a interger")
  69.     number = int(number)
  70.     print("Ok, so" ,number,"Children are filling in this questionare")
  71.     print("loading santa database")
  72.     time.sleep(1)
  73.     print(".")
  74.     time.sleep(1)
  75.     print("..")
  76.     time.sleep(1)
  77.     print("...")
  78.     time.sleep(1)
  79.     print("santa database has loaded")
  80.     for  n in range (number):
  81.         nice = 0
  82.         user = input("hello, what is your name")
  83.         time.sleep(1)
  84.         print("hello "+user)
  85.         time.sleep(1)
  86.         print("we are going to ask you some questions to decide if you are naughty or nice")
  87.         time.sleep(1)
  88.         questions()
  89.  
  90. #function
  91. start()
  92.  
  93. #finished first person in my class by 1 hour.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement