r/pythonhelp • u/Richard_Rickson • Jul 02 '22
Python assistance needed PLEASE!
So, I have been getting into python recently as my first real dive into coding(/programming idrk feel free to correct), and I have this bit of code..
----------
print('How many bois you got in your pocket?')
dolla = input()
A = 0.01
w = 0
T = 0.05
x = 0
F = 0.10
y = 0
G = 0.25
z = 0
if[dolla > G]:
z + 1
else:
if[dolla > F]:
y + 1
else:
if[dolla > T]:
x + 1
else:
w + 1
print('Your dolla = ' + w + " Andrew, " + x + ' Thomas, ' +
y + ' Franklin, and ' + z + ' Georgies.')
if{dolla >= 1}:
print(' Congrats on having a masive cock!')
else:
(" I'm so sorry for your accident involving your weener!")
----------
It shows no errors just sitting in Visual Studio Code, but shows this error when I enter "20"(no quotes) into the input box:
TypeError: '>' not supported between instances of 'str' and 'float'
I have tried a few things so far, but have not had any luck in fixing this error..
PLZ HLP,
-RR
1
u/Obed2621 Jul 02 '22 edited Jul 03 '22
As said by wolfbait, you need to convert the input to float, because input always return a string. Secondly doing x + 1 Wont change x,
You need to do x += 1 Or do this; x = x + 1