Question

In: Computer Science

Develop a python program to create a quiz with limited time and attempts!!! Add comments and...

Develop a python program to create a quiz with limited time and attempts!!! Add comments and screenshot of running the program

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()

    answered = False

    #continue till maxattempts

    while attempts < maxattempts:

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

        if ans == '4':

            answered = True

            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.
Create a Python program that includes each feature specified below. Comments with a detailed description of...
Create a Python program that includes each feature specified below. Comments with a detailed description of what the program is designed to do in a comment at the beginning of your program. Comments to explain what is happening at each step as well as one in the beginning of your code that has your name and the date the code was created and/or last modified. The use of at least one compound data type (a list, a tuple, or a...
Develop a python program to - Create a 2D 10x10 numpy array and fill it with...
Develop a python program to - Create a 2D 10x10 numpy array and fill it with the random numbers between 1 and 9 (including 0 and 9). - Assume that you are located at (0,0) (upper-left corner) and want to move to (9,9) (lower-right corner) step by step. In each step, you can only move right or down in the array. - Develop a function to simulate random movement from (0,0) to (9,9) and return sum of all cell values...
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:
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:...
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...
The first program is to count the number of zeros in $3855. Please     add comments...
The first program is to count the number of zeros in $3855. Please     add comments to each line                 org   $1000 array     db $38, $55 ; data to be tested                      org $1100 zero_cnt ds.b   1 lp_cnt     ds.b   1              org   $1500              clr   zero_cnt       ;initialize the 0 count to 0              movb #16,lp_cnt                   ldd   array         again     lsrd             bcs   chk_end         ;             inc   zero_cnt chk_end   dec   lp_cnt                           bne   again                               swi                          end
Use Python 3, please type. Write a Python 3 program which is an arithmetic quiz for...
Use Python 3, please type. Write a Python 3 program which is an arithmetic quiz for children. The program asks the user to calculate the multiplication of two numbers generated at random in your code. The numbers should be in the range 1 through 10. User input is shown in bold black font in the example below. You will need to use random numbers. You should type the recommended comments at the top of your code and include three test...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT