+ 1
Type Conversion
Guys how do I transfer a string to a integer in this situation? (Or you totally can't anyways) Here is my code: import random num = str(random.randint(1,10)) print('Your number is ' + num + '!') int(num) num += 1 print(num)
3 Respostas
+ 2
I don't really understand what you are trying with this piece of code. But I played a little bit with it, so no error occurs.
import random
num = random.randint(1,10)
print('Your number is ' + str(num) + '!')
num += 1
print(num)
+ 2
import random
num = str(random.randint(1,10))
print('Your number is ' + num + '!')
x = int(num)
x += 1
print(x)
Also possible
0
Thanks a lot