+ 1
Is there any wrong thing in this code?.
if usr in value: print ("Nice work, you guessed right") else: print ("Better luck next time") print ("Hope you like it, ")
13 ответов
+ 1
the input() function returns the value the user enters as a string.
here are some changes you can make:
https://code.sololearn.com/cInhj9Ck6zv7/?ref=app
+ 2
Thanks
+ 2
A lot
+ 1
but I get a TypeError code
+ 1
should I paste the full code?
+ 1
import math
from math import *
import random
print (".....")
usr = input("Enter a Number")
for i in range(5):
value = random.randint(1, 6)
print(value)
if usr in value:
print (".....t")
else:
print (".....")
print ("....")
+ 1
value is a list and usr is an int
+ 1
value is like a list of ints
+ 1
but i didn't use usr as "str" so how is that possible
and please show me what I can do to solve this
0
if usr and value are variables then I see no problem.
0
if you post a link for the code in the playground is even better.
0
what type is usr and value?
0
But according to your code value is of type int and usr is of type string. That's why your getting the TypeError.