this is the code down below
I am not sure if of the 22 variables it does not guess the number or have I done something wrong
JavaScript
x
27
27
1
print("pick a number between 1 and 10 and type it down below")
2
numberone = input()
3
n1 = random.randint(1,10)
4
n2 = random.randint(1,10)
5
n3 = random.randint(1,10)
6
n4 = random.randint(1,10)
7
n5 = random.randint(1,10)
8
n6 = random.randint(1,10)
9
n7 = random.randint(1,10)
10
n8 = random.randint(1,10)
11
n9 = random.randint(1,10)
12
n10 = random.randint(1,10)
13
n11 = random.randint(1,10)
14
n12 = random.randint(1,10)
15
n13 = random.randint(1,10)
16
n14 = random.randint(1,10)
17
n15 = random.randint(1,10)
18
n16 = random.randint(1,10)
19
n17 = random.randint(1,10)
20
n18 = random.randint(1,10)
21
n19 = random.randint(1,10)
22
n20 = random.randint(1,10)
23
n21 = random.randint(1,10)
24
n22 = random.randint(1,10)
25
if (n1,n22) == numberone:
26
print("i guess your number and it is" + input())
27
if you are reading this, Thank you so much for just attempting to help someone! you are a good person and are willing to help others
Advertisement
Answer
its very good to explain what you exactly you want to do.
i assume you want to guess the number with 22 attempts and check if any of them got the record.
JavaScript
1
16
16
1
import random
2
3
print("pick a number between 1 and 10 and type it down below")
4
number = int(input())
5
6
if not 0 < number < 11:
7
print("you should've entered a number between 1 and 10 :(")
8
9
guesses_result = []
10
11
for i in range(22):
12
guesses_result.append(random.randint(1, 10))
13
14
if number in guesses_result:
15
print(f"i guess your number and it is {number}")
16