File tree Expand file tree Collapse file tree 3 files changed +10
-24
lines changed Expand file tree Collapse file tree 3 files changed +10
-24
lines changed Original file line number Diff line number Diff line change 11import random
22rules = 'Answer "yes" if given number is prime. Otherwise answer "no".'
3+ def is_prime (n ):
4+ if n < 2 :
5+ return False
6+ for i in range (2 , int (n ** 0.5 ) + 1 ):
7+ if n % i == 0 :
8+ return False
9+ return True
10+
311def get_round ():
412 num = random .randint (1 , 50 )
513 question = f'Question: { num } '
6- for i in range (1 , num ):
7- if num % i == 0 and i != num and i != 1 :
8- correct_answer = 'no'
9- break
10- else :
11- correct_answer = 'yes'
14+ correct_answer = 'yes' if is_prime (num ) else 'no'
1215 return question , correct_answer
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11[project ]
22name = " hexlet-code"
3- version = " 0.6.2 "
3+ version = " 0.6.3 "
44description = " Add your description here"
55readme = " README.md"
66requires-python = " >=3.10"
You can’t perform that action at this time.
0 commit comments