##### Question

In: Computer Science

quiz could be of anything like , what's the sum of 2&2.
There should be number of attempts(limited) suppose if the answer is wrong.

## Solutions

##### Expert Solution

OUTPUT:

CODE:

TEXT:

import time

def question(maxattempts,maxtime):

attempts = 0

start = time.perf_counter()

#continue till maxattempts

while attempts < maxattempts:

ans = input('Whats the sum of 2 and 2 : ')

if ans == '4':

break

attempts = attempts + 1

stop = time.perf_counter()

#check if the time exceeded or the attempts exceeded

if stop - start >= maxtime or attempts >= maxattempts:

return False

else:

return True

if question(4,10):

print('you won')

else:

print('Chance lost')

## Related Solutions

##### Develop a python program that prompts the user to take up the quiz (which has choices)...
Develop a python program that prompts the user to take up the quiz (which has choices) with limited attempts and limited time. Suppose if the user answered wrong then they have to get numer of attempts(limited) Quiz should have questions on General knowldge & multiple choices for those questions
##### Develop a python program to ask the user to take up the quiz(General knowledge) which has...
Develop a python program to ask the user to take up the quiz(General knowledge) which has around 4 or 5 questions & choices for those questions. For each question user should have 2 or 3 attempts suppose if they are wrong. Develop the in such a manner to add few more questions and remove some questions.
##### Write a Python program to (a) create a new empty stack. Then, (b) add items onto...
Write a Python program to (a) create a new empty stack. Then, (b) add items onto the stack. (c) Print the stack contents. (d) Remove an item off the stack, and (e) print the removed item. At the end, (f) print the new stack contents:
##### Please add to this Python, Guess My Number Program. Add code to the program to make...
Please add to this Python, Guess My Number Program. Add code to the program to make it ask the user for his/her name and then greet that user by their name. Please add code comments throughout the rest of the program If possible or where you add in the code to make it ask the name and greet them before the program begins. import random def menu(): print("\n\n1. You guess the number\n2. You type a number and see if the...
##### C++ polymorphism. Create a program that issues a quiz through the terminal. The quiz will ask...
C++ polymorphism. Create a program that issues a quiz through the terminal. The quiz will ask a variety of C++ questions to the user and prompt them for a response. The response will differ based on the type of question, such as true or false, multiple-choice, or fill in the blank. Part 1: Designing the Quiz Design this program using a polymorphic vector of questions. Create a Question base class that will serve to point to three different derived classes:...
##### Develop the following code for quiz (i am getting some errors)in python in such a manner...
Develop the following code for quiz (i am getting some errors)in python in such a manner that it shoulde be having extra 3 attempts(for wrong answrs) for all questions if the user entered wrong answer ยท for ex: If the user entered correct answer for first question #then 3 attempts will be carried to next questions. If the user entered 3 times wrong answer in 1st question itself means it sholud display as no more attempts and you got o...
##### Create a Python script in IDLE or Kali Python3 CLI to create the following Python Program:...
Create a Python script in IDLE or Kali Python3 CLI to create the following Python Program: Your program will create a username of your choice using a Kali Linux command "useradd -m mark", then set the password for that user using the Kali Linux Command "echo "mark:10101111" | chpasswd". Then you create a dictionary file using the Kali Linux command "crunch 8 8 01 > mylist.txt" Your python script should crack the password for that user and display on the...
##### Write a Python program (with comments) to do the following: Assign the value '2+1' to a...
Write a Python program (with comments) to do the following: Assign the value '2+1' to a variable str1. Use the eval() function to evaluate str1and assign the result to a variable num1. Ask the user to input their birth month and assign it to a variable month and then print it with a suitable message. Determine the number of letters in month and display the result with a suitable message. Determine how many times the letter 'r ' occurs in...