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.
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
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT