Iti1120 Assignment Abroad

#ITI 1120 #Assignment 2 #Oduba Utuera #8271292 #Part1 #Question 1 import random def perform_test(): '''(user)-> None A tool created to teach arithmetic operations using addition and multiplication. ''' #addition function correctAnswers=0 if selection1=='0': for i in range(0, amountOfQuestions): num1=random.randint(0,9) num2=random.randint(0,9) answer=num1+num2 print(num1, '+' ,num2, '=') userAnswer=int(input('What is your answer? ')) if userAnswer==answer: print('Correct!') correctAnswers +=1 else: print('Wrong, the correct answer is', answer) #multiplication function else: for i in range (0, amountOfQuestions): num1=random.randint(0,10) num2=random.randint(0,10) answer=num1*num2 print(num1, '*' ,num2, '=') userAnswer=int(input('What is your answer?')) if userAnswer==answer: print('Correct!') correctAnswers +=1 else: print('Wrong, the correct answer is', answer) #calculate the amount of correct ansers percentageOfCorrectAnswers= (correctAnswers/amountOfQuestions) if percentageOfCorrectAnswers >=0.8: print('Well done! Congratulations') elif percentageOfCorrectAnswers >=0.6 and percentageOfCorrectAnswers <= 0.8: print ('Not too bad but please study and practice some more.')

Я с ним говорил, но… - Надеюсь, вы отчитали его как следует! - воскликнул Клушар. Беккер кивнул: - Самым решительным образом. Консульство этого так не оставит. - Надеюсь.

0 comments

Leave a Reply

Your email address will not be published. Required fields are marked *