Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Code your own Quiz
- #--> Fill in the blanks Quiz
- print "\n Welcome to my quiz about digitalization. Let's see if you can master the future.\n"
- print "\n Just type in the missing blanks: ___1___ ___2___ ___3___ ___4___ \n"
- print "How many attempts do you want to give yourself?"
- attempts = raw_input() #user has to input how many attempts he wants to play with
- attempts = int(attempts) #the number of attempts gets changed into an integer
- #easy
- easy1 = "At the moment, ___1___ is one of the most important topics. It is also called ___2___. Studies predict that by 2020 there will be 200 billion connected devices on the ___3___ which also comes more and more in our everyday life thanks to smart devices like Amazon ___4___."
- easy2 = "The ___1___ economy is about owning the customer-supply interface. ___2___, the world's largest taxi company, owns no vehicles. ___3___, the world's most popular media owner, creates no content. And ___4___, the world's largest accommodation provider, owns no real estate."
- easy3 = "Only 42 percent of companies say they know how to extract meaningful insights from the ___1___ available to them. 87 percent of finance executives believe they need to analyze ___2___ and performance data much more quickly. Ten years from now, when we look back at how this era of ___3___ evolved...we will be stunned at how uninformed we used to be when we made decisions. - Billybosworth, DataStax CEO. By 2018, the data created by the Internet of Things devices will reach 403 trillion gigabytes a ___4___."
- #medium
- medium1 = "73 percent of ___1___ believe the lack of employees with key technical skills is a threat to their company's growth. By 2019, approximately one quarter of the entire U.S. workforce will be independent (workers, independent contractor, ___2___, temp contractor, etc). 62 percent of ___3___ want their career to have a positive impact on the world, and 53 percent would work harder if their organization was making a difference to others. People are increasingly creating ___4___ incomes through online platforms and marketplaces like Airbnb, Etsy, Thumbtack, Uber and Upwork."
- medium2 = "The average internet user spends 1.72 hours on ___1___ per day. But only 39 percent of companies leverage use ___2___ to improve recruiting, engagement, and employer brand. There will be more words written on ___3___ in the next two years than contained in all books ever printed. ___4___ internet users are online approximately 3 times as long as Asian internet users."
- medium3 = "Businesses are no longer the sole creator of a ___1___; it is co-created by consumers through shared experiences and defined by the results of online searches and conversations. 70 percent of ___2___ are more likely to recommend a brand because it provides a simpler experience, and 38 percent are willing to pay more for simpler experiences. Brands that are loved by consumers, experience ___3___ appreciation 10 times more than brands that are less loved. 84 percent of global consumers actively seek out socially and ___4___ responsible brands, and 90 percent are willing to switch purchases to brands associated with a good cause."
- #hard
- hard1 = "___1___ and ___2___ consumers are more than twice as likely to make purchases with their mobile phones, as consumers in the U.S., U.K., Japan, Germany and France. In the U.S., in-store payments with ___3___ will reach $808 billion by 2019, more than 21 times the $37 billion expected for 2015. 45 percent of shoppers who used their mobile device for ___4___ also used it for making a purchase."
- hard2 = "At the current turnover rate, 75 percent of the companies in the ___1___ in 2027, will be new (companies not currently in index today). By 2025, there will be 10 global ___2___ that will be considered mainstream. Their combined market value will exceed $5 trillion, and ___3___ will still be the largest. ___4___ will grow 200,000 percent from 2015 to 2030."
- hard3 = "There is now widespread agreement and emerging evidence, that access to ___1___ can help improve quality of life and accelerate development efforts at all levels. 38 million global deaths were due to ___2___ diseases. This invisible epidemic hinders the ___3___ of many countries. The first decade of this century witnessed a historic reduction in global poverty and a near doubling of the middle class, but 71 percent of the global population still subsists on less than $10 a day, and 1 billion people live on less than ___4___ a day."
- #answers
- easy1_solutions = ["digitalization", "new economy", "internet of things", "Echo"]
- easy2_solutions = ["sharing", "Uber", "Facebook", "Airbnb"]
- easy3_solutions = ["data", "financial", "big data", "year"]
- medium1_solutions = ["CEOs", "freelancer", "Millennials", "supplemental"]
- medium2_solutions = ["social networks", "social media data", "Twitter", "Latin American"]
- medium3_solutions = ["brand","consumers", "brand value", "environmentally"]
- hard1_solutions = ["Chinese", "Indian", "mobile wallet apps", "social media"]
- hard2_solutions = ["S&P 500", "virtual currencies", "Bitcoin", "Crowd funding"]
- hard3_solutions = ["technology", "noncummunicable", "economic development", "2$"]
- #blanks
- blanks = ["___1___", "___2___", "___3___", "___4___"]
- #input_list
- input_list = ["easy", "medium", "hard"]
- #global variables:
- easy_level = 0
- medium_level = 1
- hard_level = 2
- #function which is responsible for the structure of the difficulty easy; Input: easy-paragraphs and easy-solutions // Output: paragraphs with filled blanks
- #and congratulations if you win, but also game over if you do not have attempts left
- def easy():
- global attempts
- print "Your difficulty will be " + str(input_list[easy_level]) + ". Let's go!"
- print "\n Level 1\n"
- game(easy1, easy1_solutions, blanks) #executes the game function for the difficulty easy
- if attempts > 0:
- print "\n Level 2\n"
- game(easy2, easy2_solutions, blanks)
- else:
- return
- if attempts > 0:
- print "\n Level 3\n"
- game(easy3, easy3_solutions, blanks)
- print "\n Congratulations! You won! \n" #congrats the user, if he was able to figure out everything --> victory
- return "Designed and coded by Daniel Grittner"
- else:
- return
- #function which is responsible for the structure of the difficulty medium; Input: medium-paragraphs and medium-solutions // Output: paragraphs with filled blanks
- #and congratulations if you win, but also game over if you do not have attempts left
- def medium():
- global attempts
- print "Your difficulty will be " + str(input_list[medium_level]) + ". Let's go!"
- print "\n Level 1\n"
- game(medium1, medium1_solutions, blanks) #executes the game function for the difficulty medium
- if attempts > 0:
- print "\n Level 2\n"
- game(medium2, medium2_solutions, blanks)
- else:
- return
- if attempts > 0:
- print "\n Level 3\n"
- game(medium3, medium3_solutions, blanks)
- print "\n Congratulations! You won! \n" #congrats the user, if he was able to figure out everything --> victory
- return "Designed and coded by Daniel Grittner"
- else:
- return
- #function which is responsible for the structure of the difficulty hard; Input: hard-paragraphs and hard-solutions // Output: paragraphs with filled blanks
- #and congratulations if you win, but also game over if you do not have attempts left
- def hard():
- global attempts
- print "Your difficulty will be " + str(input_list[hard_level]) + ". Let's go!"
- print "\n Level 1\n"
- game(hard1, hard1_solutions, blanks) ##executes the game function for the difficulty hard
- if attempts > 0:
- print "\n Level 2\n"
- game(hard2, hard2_solutions, blanks)
- else:
- return
- if attempts > 0:
- print "\n Level 3\n"
- game(hard3, hard3_solutions, blanks)
- print "\n Congratulations! You won! \n" #congrats the user, if he was able to figure out everything --> victory
- return "Designed and coded by Daniel Grittner"
- else:
- return
- #Function with which the user decides the difficulty of the game. Input: easy, medium or hard // Output: strings, links to the game function in dependence of the difficulty
- def difficulty():
- print "Choose your difficulty by typing in easy, medium or hard:"
- user_input = raw_input() #user has to type in his difficulty he wants to play with
- print " "
- if user_input == input_list[0]: #this will be executed if the user types in easy
- easy()
- elif user_input == input_list[medium_level]: #this will be executed if the user types in medium
- medium()
- elif user_input == input_list[hard_level]:#this will be executed if the user types in hard
- hard()
- else: #if user_input not in input_list: #if the user does not type in easy, medium or hard, he receives an error message
- print "Error: You did not type in the required difficulty. Try again."
- #function for the game procedure; Input: the questions and solutions in dependence of the difficulty and the blanks-list//Output: strings like Level 1 (question paragraph) and the function also replaces the
- #blanks with the correct word, it is also responsible for the number of attempts
- def game(difficulty_questions, difficulty_solutions, blanks):
- print difficulty_questions
- index = 0
- length_of_list = 4
- global attempts
- while index < length_of_list: #loops through the blanks list until all blanks are filled
- print "\n"
- answer = raw_input("Number " + str(index + 1) + " is:") #user has to put in his answer for the blanks
- if answer == difficulty_solutions[index]:
- difficulty_questions = difficulty_questions.replace(blanks[index], difficulty_solutions[index]) #if he answers right, the blank gets replaced with the right solution
- index += 1
- else: #this gets executed when the player answers wrong
- if attempts == 1: #if he had one attempt left, he lost (1 - 1 = 0) --> Game over
- return "Game over!"
- else:
- attempts = attempts - 1 #this reduces the attempts if he answers wrong
- print "Attempts left: " + str(attempts)
- print "\n"
- print difficulty_questions
- difficulty()
Advertisement
Add Comment
Please, Sign In to add comment