Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cumulating results
#7
micseydel
Yessss. Clap
my brother now thinks i'm a gig. for writing a home made mental arithmetic code for his kid. Big Grin
quite amateur, but i'm thrilled i've reached here, i think i'll hang on thanks to your guides. Wink

import time
import random
points = 0
max_points = 0
count= 1
while True:
    print('Question:', (count))
    print(str('--') * 10)
    count = count + 1
    multi_value = random.randint(2, 12)
    input_value = random.randint(2, 12)
    print('what is,', multi_value, 'x', input_value, '?')
    correct_answer = int(multi_value * input_value)
    answer = input('Answer = :', )
    if correct_answer > 30:
        points_value = 3
    elif correct_answer < 30:
        points_value = 2
    if int(answer) == int(correct_answer):
        time.sleep(1)
        print('CORRECT :',points_value, 'pts')
        points = points + points_value
    else:
        print('WRONG ANSWER')
    max_points = max_points + points_value
    if count == 6:
        print(str('--') * 10)
        print('\nRESULT\n')
        print('You got :', points,'PTS','out of:', max_points)
        break
    print(str('--') * 10)
Reply


Messages In This Thread
cumulating results - by awasnipi - Sep-09-2020, 02:27 AM
RE: cumulating results - by bowlofred - Sep-09-2020, 03:03 AM
RE: cumulating results - by awasnipi - Sep-09-2020, 06:30 AM
RE: cumulating results - by bowlofred - Sep-09-2020, 06:47 AM
RE: cumulating results - by awasnipi - Sep-09-2020, 10:55 PM
RE: cumulating results - by micseydel - Sep-09-2020, 11:11 PM
RE: cumulating results - by awasnipi - Sep-10-2020, 02:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Search Results Web results Printing the number of days in a given month and year afefDXCTN 1 2,362 Aug-21-2020, 12:20 PM
Last Post: DeaD_EyE
  How to append one function1 results to function2 results SriRajesh 5 3,365 Jan-02-2020, 12:11 PM
Last Post: Killertjuh

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020