M
M
mrlololo2021-11-06 14:56:05
Python
mrlololo, 2021-11-06 14:56:05

How to solve the problem with loops in Python?

Recently I began to study python, I decided to practice and write a program (game) in which the user must guess the number made by the computer!
v = random.randint(0, 9)
print(v)
w = int(input("Your answer"))
for w in v:
if w == v:
print("Congratulations, you won!!!"
) At the beginning of writing the program, I ran into a problem.
line ..., in
for w in v:
TypeError: 'int' object is not iterable

Explain the problem

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexbprofit, 2021-11-06
@alexbprofit

import random
v = random.randint(0, 9)
print(v)
w = int(input("Твой ответ "))
if w == v:
  print("Поздравляю ты победил!!!")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question