File tree Expand file tree Collapse file tree 5 files changed +12
-7
lines changed Expand file tree Collapse file tree 5 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -32,13 +32,14 @@ def mul(num1, num2):
3232 symbol = operators [rand_operator ]
3333 print (f'Question: { num1 } { rand_operator } { num2 } ' )
3434 correct_answer = symbol (num1 , num2 )
35+ cor_str = 'Correct answer was '
3536 user_answer = prompt .string ('Your answer: ' )
3637
3738 if int (user_answer ) == correct_answer :
3839 print ('Correct!' )
3940 count += 1
4041 else :
41- print (f"{ user_answer } is wrong answer ;(. Correct answer was '{ correct_answer } '." )
42+ print (f"{ user_answer } is wrong answer ;(. { cor_str } '{ correct_answer } '." )
4243 return print (f"Let's try again, { name } !" )
4344
4445 print (f'Congratulations, { name } !' )
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ def even():
1616 rand_to_string = str (rand_num )
1717 print (f'Question: { rand_to_string } ' )
1818 user_answer = prompt .string ('Your answer: ' )
19+ cor_str = 'Correct answer was '
1920
2021 if rand_num % 2 == 0 and user_answer == 'yes' :
2122 print ('Correct!' )
@@ -24,10 +25,10 @@ def even():
2425 print ('Correct!' )
2526 count += 1
2627 elif rand_num % 2 == 0 and user_answer == 'no' :
27- print (f"'no' is wrong answer ;(. Correct answer was 'yes'." )
28+ print (f"'no' is wrong answer ;(. { cor_str } 'yes'." )
2829 return print (f"Let's try again, { name } !" )
2930 elif rand_num % 2 != 0 and user_answer == 'yes' :
30- print (f"'yes' is wrong answer ;(. Correct answer was 'no'." )
31+ print (f"'yes' is wrong answer ;(. { cor_str } 'no'." )
3132 return print (f"Let's try again, { name } !" )
3233 else :
3334 print (f"{ user_answer } is wrong answer ;(." )
Original file line number Diff line number Diff line change @@ -17,12 +17,13 @@ def gcd():
1717 print (f'Question: { rand_num1 } { rand_num2 } ' )
1818 user_answer = prompt .string ('Your answer: ' )
1919 correct_answer = math .gcd (rand_num1 , rand_num2 )
20-
20+ cor_str = 'Correct answer was '
21+
2122 if user_answer == str (correct_answer ):
2223 print ('Correct!' )
2324 count += 1
2425 else :
25- print (f"'{ user_answer } ' is wrong answer ;(. Correct answer was '{ correct_answer } '." )
26+ print (f"'{ user_answer } ' is wrong answer ;(. { cor_str } '{ correct_answer } '." )
2627 return print (f"Let's try again, { name } !" )
2728
2829 print (f'Congratulations, { name } !' )
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ def prime():
1717 print (f'Question: { rand_num } ' )
1818 user_answer = prompt .string ('Your answer: ' )
1919 correct_answer = ''
20+ cor_str = 'Correct answer was '
2021
2122 if rand_num in prime_numbers :
2223 correct_answer = 'yes'
@@ -27,7 +28,7 @@ def prime():
2728 print ('Correct!' )
2829 count += 1
2930 else :
30- print (f"{ user_answer } is wrong answer ;(. Correct answer was { correct_answer } ." )
31+ print (f"{ user_answer } is wrong answer ;(. { cor_str } { correct_answer } ." )
3132 return print (f"Let's try again, { name } !" )
3233
3334 print (f'Congratulations, { name } !' )
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ def progression():
1616 end = random .randint (40 , 60 )
1717 step = random .randint (2 , 5 )
1818 numbers = []
19+ cor_str = 'Correct answer was '
1920
2021 for current in range (start , end , step ):
2122 numbers .append (current )
@@ -32,7 +33,7 @@ def progression():
3233 print ('Correct!' )
3334 count += 1
3435 else :
35- print (f"{ user_answer } is wrong answer ;(. Correct answer was { correct_answer } ." )
36+ print (f"{ user_answer } is wrong answer ;(. { cor_str } { correct_answer } ." )
3637 return print (f"Let's try again, { name } !" )
3738
3839 print (f'Congratulations, { name } !' )
You can’t perform that action at this time.
0 commit comments