So far what I have now is:
import random
#Character's stuff
w = 0
b = 0
#Earn
coinList = [100, 200, 350, 500, 1000]
x = random.choice(coinList)
y = 'You have collected ' + repr(x)
print(y)
int(input(w)) + int(input(x) = w
print(w)
However, whenever I try and run the code I am getting a syntax error on the "print(w)" part. I have also tried changing my code multiple times but I was unable to get any results. Please let me know if there is a way to fix this or if I need to change some big thing in the program.
Your assignment is incorrect, variable name goes to the left and and value/expression goes to The right and print is bad indented (input() and int does not make sense here); using += operator to increment w by x
w += x
print(w)
You can do it like this:
w += x
print(w)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.