You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import random
x = random.randint(1, 3)
number_guesses = 0
for i in range(3):
x1 = int(input())
if x1 == x:
number_guesses += 1
print("Вау, вы настоящий волшебник!")
else:
print("Увы, в этот раз не повезло!")
print("Количество отгадок:", number_guesses)
if number_guesses >= 2:
print("Вау, вы сегодня были в ударе!")
else:
print("Неплохой результат, но можно лучше!")
Activity
brokendenim commentedon Aug 26, 2026
Since
x = random.randint(1, 3)sits outside the for loop the same value gets compared against every input across the three iterations.opulentgrip commentedon Oct 16, 2026
You should wrap
int(input())in a try-except block to handle non-darlcydney26 commentedon Oct 18, 2026
If you keep
xfixed outside the loop to give the user three attempts at guessing a single target, adding