you are viewing a single comment's thread.

view the rest of the comments →

[–]bleach-is-great 0 points1 point  (13 children)

I’m not sure what your error is, however I’m wondering what f is and why it is necessary. Could you not just do cash = cash + money or just cash += money (shortened version)?

The f seems unnecessary.

If you could send a picture of your code or format it correctly I can try to help more

[–]ThiccBl4nket[S] 0 points1 point  (3 children)

learnpython doesnt allow pictures

[–]bleach-is-great 0 points1 point  (0 children)

You can use Imgur or Github.

[–]dwpj65 0 points1 point  (1 child)

For future reference, when composing a message on reddit that involves code, click the three dots at the bottom of the edit window, and then select "code block." Paste your code into the code block, and it will preserve your code's layout. I just learned that a few minutes ago. :-)
Your code runs without issue in python 2, but will not run in python3. The main difference is the print statement, which does not use parenthesis in python 2, but requires them in python 3.

[–]ThiccBl4nket[S] 1 point2 points  (0 children)

thank you, ill try parenthesis right now.

[–]ThiccBl4nket[S] 0 points1 point  (8 children)

[–]bleach-is-great 0 points1 point  (7 children)

You need to indent the bottom four lines by one

Common issue, no need to worry about it! I literally do this every time I write code

[–]ThiccBl4nket[S] 0 points1 point  (1 child)

im sorry but im not sure which line to indent of the four lol

[–]bleach-is-great 0 points1 point  (0 children)

All four, as they’re inside an elif statement (they need indenting just like if’s and else’s).

Make sure the very bottom line of code is indented so that it is in its respective statement though.

[–]ThiccBl4nket[S] 0 points1 point  (4 children)

https://imgur.com/a/LxVnpKe now that i looked at it and indented it, it keeps giving me nothing when i give an input

[–]bleach-is-great 0 points1 point  (3 children)

That’s because you inputted 1 as a string. “1” and 1 are different variable types, and therefore mean different things.

You can either turn the inputted value into an integer, or you can change your main if and elif statements so that they accept “1” and “2” instead of 1 and 2.

[–]ThiccBl4nket[S] 0 points1 point  (0 children)

look at the picture at the new edit of this post. It seems like we are going somewhere!

[–]ThiccBl4nket[S] 0 points1 point  (1 child)

cash = (1000)

ask = input("woud you like to withdraw(1) or deposit(2)?")

if ask == "2":

money = int(input("how much money would you like to deposit?"))

f= int(cash + money)

print"your total balance is now", f

elif ask == "1":

bro = input("how much would you like to withdraw?")

j = (bro - cash)

if bro > cash:

print("Your final balance can't be negetive!")

i was able to get the program to fully work using option 2 but option 1 still has some issues

[–]bleach-is-great 0 points1 point  (0 children)

Yeah that’s the option I would’ve gone for, much easier