#movies print ("Night at the Movies!") print () def main(): print() t = 0 print ("Familiarity breeds convivality, right? A whole host of good movies") print ("are on TV tonight at the same time. How do you decide which movie") print ("to watch? Based on existing knowledge, AI has all the answers.") print () print ("Press enter to continue.") az = input() print ("\033[H\033[J") print ("*** Part One ***") print () print ("In which order were these Harry Potter movies released?") print () print ("A.Harry Potter and the Goblet of Fire.") print ("B.Harry Potter and the Chamber of Secrets.") print ("C.Harry Potter and the Deathly Hallows Part 2.") print ("D.Harry Potter and the Half-blood Prince.") print ("E.Harry Potter and the Prizoner of Azkaban.") print ("F.Harry Potter and the Deathly Hallows Part 1.") print ("G.Harry Potter and the Order of the Phoenix.") print ("H.Harry Potter and the Philosopher's Stone.") print () print ("D A F G B E H C") print () print ("H B E A G D F C") print () print ("A B C D E F G H") print () print ("B H F A D C E G") print () aa = 0 aa = input() print () if aa == "H B E A G D F C": print ("Score 15 points.") t += 10 elif aa == "D A F G B E H C": print ("Score 5 points.") t == 5 elif aa == ("B H F A D C E G"): print () print ("Score 5 points.") t += 5 else: print("Score 0 points.") print ("Press enter to continue.") ab = input() print ("\033[H\033[J") print ("*** Part Two ***") print () print () print ("A B") print ("The Dark Knight. The Incredible Hulk.") print ("Twilight. Step Brothers.") print ("Iron Man. Taken.") print () print ("C D") print ("Slumdog Millionaire. The Spy Next Door.") print ("The Happening. Quantum of Solace.") print ("WALL-E. Rambo.") print () print ("E F") print ("Changeling. Cloverfield") print ("The Reader. The House Bunny.") print ("***** and the City. Seven Pounds.") print () print ("Which set of movies contains 3 movies released in 2008?") print () print ("a. A and C.") print ("b. B and D.") print ("c. E and F.") print ("d. All except D.") print () ac = input() if ac == "b": print ("Score 5 points.") t += 5 elif ac == "d": print ("Score 30 points.") t += 10 else: print ("Score 0 points.") print ("Press enter to continue.") ae = input() print ("\033[H\033[J") print ("*** Part Three ***") print () print ("In which year is Emma Stones date of birth?") print ("a. 1974") print ("b. 1979") print ("c. 1988") print ("d. 2003") print () print ("Hint: It is a leap year.") j = 0 for j in range (5): print ("Enter a year: ") x = int(input()) if (x)%4 != 0: print ("Not a leap year.") elif (x)% 100 != 0: print ("Leap year.") elif (x) %400 != 0: print ("Not a leap year.") j += 1 print () af = 0 print ("What is your best guess? (a, b, c or d)") ag = input() if ag == "c": print ("Score 25 points.") t += 10 else: print ("Score 0 points.") print () print ("Press enter to continue.") af = input() print ("\033[H\033[J") print ("*** Part Four ***") print () print ("A Prayer Before Dawn") print ("Bisbee '17 ") print ("Burning") print ("Filmworker") print ("First Reformed") print ("Leave No Trace") print ("Love After Love") print ("The Endless") print ("The Favourite") print ("Thunder Road") print ("Paddington 2") print ("You Were Never Really Here") print ("Zama") print () print ("Which year were these movies released?") ai = input() if af == "2018": print ("Score 50 points.") t += 50 elif af == "2012" or "2014" or "2016": print ("Score 20 points.") t += 20 elif af == "2015" or "2017" or "2019": print ("Score 5 points") t += 5 else: print ("Score 0 points.") print () print ("Press enter to continue.") aj = input() print ("\033[H\033[J") print ("*** Part Five ***") print () print ("A. A Stage of Twilight F. Avatar 2") print ("B. Supernova G. Nobody") print ("C. The Endless H. Proof") print ("D. 1000: THe Sword in the Stone I. Babylon") print ("E. Eden II ") print () print ("These movies, due to be released at a future date can be paired") print ("up by release date leaving one movie already released in 2018." ) print ("Which movie is without a pair?") print () ak = input() if ak == "C": print ("Score 30 points") t += 30 else: print ("Score 0 points.") print ("Press enter to continue.") al = input() print ("\033[H\033[J") print ("*** Part Six ***") print () print ("A. Joker II") print ("B. Swarm") print ("C. Merise Merise") print ("D. Homebody") print ("E. The Great Escape of Mr. Swag Boss") print ("F. This is Jessica") print ("G. Good Morning, Good Afternoon, Good Evening") print ("H. Lemon Cake") print ("I. Retrospect") print ("J. Nightshift") print ("K. What I Can't Tell You") print () print ("All of these movies have received an IMDb rating of 10.0") print ("They were all but one released in 2021. Which movie was") print ("released in 2016?") print () am = input() if am == "H": print ("Score 35 points.") t += 35 else: print ("Score 0 points.") print () print ("Press enter to continue.") an = input() print ("\033[H\033[J") print ("*** Part Seven ***") print () print ("The Hunger Games, 7.2") print ("Django Unchained, 8.4") print ("The Dark Knight Rises, 8.4") print ("Pitch Perfect, 7.1") print ("The Impossible, 7.6") print ("Jump Street, 7.2") print ("Prometheus, 7.2") print ("The Hunt, 8.3") print ("Skyfall, 7.7") print ("Jack Reacher, 7.0") print ("Moonrise Kingdom, 7.8") print ("Savages, 6.5") print ("The Master, 7.2") print ("Ted, 6.9") print () print ("These movies were all released in 2016.") print ("What is the avarage rating of all 14 movies?") print () print ("A. 7.2") print ("B. 7.3") print ("C. 7.5") print ("D. 7.7") print () ao = input() if ao == "A": print ("Score 5 points.") t += 5 elif ao == "B": print ("Score 5 points.") t += 5 elif ao == "C": print ("Score 20 points.") t += 20 elif ao == "D": print ("Score 0 points.") else: print ("Score 0 points.") print () print ("Press enter to continue.") ao = input() print ("\033[H\033[J") print ("*** Part Eight ***") print () print ("Here is a list of stars, movies and birthdays.") print () print ("Leonardo DiCapio, Shutter Island, dob. 1974.") print ("Gwyneth Paltrow, Iron Man 2, dob. 1972.") print ("Sylvester Stalone, The Expendables, dob. 1946") print ("Sarah Jessica Parker, ***** and the City(2), dob. 1953") print ("Natalie Portmab, Black Swan, dob. 1981") print ("Justin Timberlake, The Social Network, dob. 1981") print ("Julie Andrews, Despicable Me, dob. 1935") print ("Jeff Bridges, The Door in the Floor, dob. 1949") print () print ("Enter the birth years in any order: ") print () #b = input() #stars = [] #stars.sort() #print (stars) import random random_list = 0 n = 0 o = 0 p = 0 i = 0 print ("Enter birth year: ") ca = input() print ("Enter birth year: ") cb = input() print ("Enter birth year: ") cc = input() print ("Enter birth year: ") cd = input() print ("Enter birth year: ") ce = input() print ("Enter birth year: ") cf = input() print ("Enter birth year: ") cg = input() print ("Enter birth year: ") ch = input() random_list = [ca, cb, cc, cd, ce, cf, cg, ch] random_list.sort() print () print ("Years sorted in chronological order:") print () print (random_list) print () print ("Score 25 points.") t += 25 print () print ("Press enter to continue.") ci = input() print ("\033[H\033[J") print () print ("*** Part Nine ***") print () #print ( A["Movie"] ) random_list =[] random_table = [] A = {"Movie":"Submarine", "rating": 7.3} B = {"Movie":"Black Swan", "rating": 8.0} C = {"Movie":"Never Let Me Go", "rating": 7.1} D = {"Movie":"All Good Things", "rating": 6.3} E = {"Movie":"Faster", "rating": 6.4} F = {"Movie":"Rabbit Hole", "rating": 7.0} G = {"Movie":"Greenberg", "rating": 6.1} H = {"Movie":"The Fight", "rating": 7.8} I = {"Movie":"Salt", "rating": 6.4} J = {"Movie":"Easy A", "rating": 7.0} ea = 0 ee = 0 j = 0 random_list =[] random_table = [] for j in range (1): print ("These movies were all released in 2010.") print ("Can you sort these movies?") ea == input() print("Press enter to continue.") eb = input() ee == input() if ee == "A": print() #ef = input() print (A["Movie"],", ", A["rating"]) random_table.append(A["Movie"]) random_list.append(A["rating"]) random_list = sorted (random_list, reverse = True) print (random_list) print() if ee == "B": print() #eg = input() print (B["Movie"],", ", B["rating"]) random_table.append(B["Movie"]) random_list.append(B["rating"]) random_list = sorted (random_list, reverse = True) print (random_list) print() if ee == "C": print() #eh = input() print (C["Movie"],", ", C["rating"]) random_table.append(C["Movie"]) random_list.append(C["rating"]) random_list = sorted (random_list, reverse = True) print (random_list) print() if ee == "D": print() #ei = input() print (D["Movie"],", ", D["rating"]) random_table.append(D["Movie"]) random_list.append(D["rating"]) random_list = sorted (random_list, reverse = True) print (random_list) print() if ee == "E": print() #ej = input() print (E["Movie"],", ", E["rating"]) random_table.append(E["Movie"]) random_list.append(E["rating"]) random_list = sorted (random_list, reverse = True) print (random_list) print() if ee == "F": print() #ek = input() print (F["Movie"],", ", F["rating"]) random_table.append(F["Movie"]) random_list.append(F["rating"]) random_list = sorted (random_list, reverse = True) print (random_list) print() if ee == "G": print() #el = input() print (G["Movie"],", ", G["rating"]) random_table.append(G["Movie"]) random_list.append(G["rating"]) random_list = sorted (random_list, reverse = True) print (random_list) print() if ee == "H": print() #em = input() print (H["Movie"],", ", H["rating"]) random_table.append(H["Movie"]) random_list.append(H["rating"]) random_list = sorted (random_list, reverse = True) print (random_list) print() if ee == "I": print() #xn = input() print (I["Movie"],", ", I["rating"]) random_table.append(I["Movie"]) random_list.append(I["rating"]) random_list = sorted (random_list, reverse = True) print (random_list) print() if ee == "J": print() #xo = input() print (J["Movie"],", ", J["rating"]) random_table.append(J["Movie"]) random_list.append(J["rating"]) random_list = sorted (random_list, reverse = True) print (random_list) print() print ("Score is", t) t += 25 j += 1 fc = 0 print ("Press enter to continue.") fc = input() print ("\033[H\033[J") print ("*** Part Ten ***") print () print ("How many of these people starred in Toy Story?") print () fa = 0 print ("1. Tom Hanks, (Woody)") print ("2. Tim Allen, (Buzz Lightyear)") print ("3. Don Rickles, (Mr Potatohead)") print ("4. Jim Varney, (Slinky Dog)") print ("5. Wallace Shawn, (Rex)") print ("6. John Ratzenberger, (Hamm)") print ("7. Annie Pots, (Bo Peep)") print () print ("a. 1, 3, 7") print ("b. 2, 3, 4") print ("c. 5, 6, 7") print ("d. All of them.") print ("e. None of them.") print () fa = input() if fa == "a" or "b" or "c": print ("Score 5 points.") t += 5 if fa == "d": print ("Score 20 points.") t += 20 elif fa == "e": print ("Score 0 points.") print () if t == 0: print ("Better luck next time.") else: print ("Total Score: ", t, "points.") print () print(t, "is a good score! Existing information suggests that you might") if 21 < t < 50: print ("prefer to watch a Harry Potter movie .") elif 0 < t < 100: print ("prefer to watch 'Toy Story'.") elif 101 < t < 150: print ("prefer to watch a movie starring Emma Stone." ) elif t>= 151: print ("prefer to watch a movie starring Kevin Bacon.") ##################################
Write, Run & Share Python code online using OneCompiler's Python online compiler for free. It's one of the robust, feature-rich online compilers for python language, supporting both the versions which are Python 3 and Python 2.7. Getting started with the OneCompiler's Python editor is easy and fast. The editor shows sample boilerplate code when you choose language as Python or Python2 and start coding.
OneCompiler's python online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample python program which takes name as input and print your name with hello.
import sys
name = sys.stdin.readline()
print("Hello "+ name)
Python is a very popular general-purpose programming language which was created by Guido van Rossum, and released in 1991. It is very popular for web development and you can build almost anything like mobile apps, web apps, tools, data analytics, machine learning etc. It is designed to be simple and easy like english language. It's is highly productive and efficient making it a very popular language.
When ever you want to perform a set of operations based on a condition IF-ELSE is used.
if conditional-expression
#code
elif conditional-expression
#code
else:
#code
Indentation is very important in Python, make sure the indentation is followed correctly
For loop is used to iterate over arrays(list, tuple, set, dictionary) or strings.
mylist=("Iphone","Pixel","Samsung")
for i in mylist:
print(i)
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while condition
#code
There are four types of collections in Python.
List is a collection which is ordered and can be changed. Lists are specified in square brackets.
mylist=["iPhone","Pixel","Samsung"]
print(mylist)
Tuple is a collection which is ordered and can not be changed. Tuples are specified in round brackets.
myTuple=("iPhone","Pixel","Samsung")
print(myTuple)
Below throws an error if you assign another value to tuple again.
myTuple=("iPhone","Pixel","Samsung")
print(myTuple)
myTuple[1]="onePlus"
print(myTuple)
Set is a collection which is unordered and unindexed. Sets are specified in curly brackets.
myset = {"iPhone","Pixel","Samsung"}
print(myset)
Dictionary is a collection of key value pairs which is unordered, can be changed, and indexed. They are written in curly brackets with key - value pairs.
mydict = {
"brand" :"iPhone",
"model": "iPhone 11"
}
print(mydict)
Following are the libraries supported by OneCompiler's Python compiler
Name | Description |
---|---|
NumPy | NumPy python library helps users to work on arrays with ease |
SciPy | SciPy is a scientific computation library which depends on NumPy for convenient and fast N-dimensional array manipulation |
SKLearn/Scikit-learn | Scikit-learn or Scikit-learn is the most useful library for machine learning in Python |
Pandas | Pandas is the most efficient Python library for data manipulation and analysis |
DOcplex | DOcplex is IBM Decision Optimization CPLEX Modeling for Python, is a library composed of Mathematical Programming Modeling and Constraint Programming Modeling |