Ask coding questions

← Back to all posts
How to use two variables in a python boolean statement?
bwoop (112)

I am making a tycoon game, and you get money by adding your money to your earnings. I tried to put this in a function, but when I run it, nothing happens. I know that I could manually change add the money to the earnings, but it would be good to know how to do it this way. Thanks in advance!

Answered by Coder100 (17136) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (17136)

you need to return it lol

def addMoney():
  return Money == Money + Earnings

otherwise python doesn't do anything with the expr

bwoop (112)

@Coder100 oh, my bad lol. Thanks!

Coder100 (17136)

@bwoop lol did you forget to call the function

bwoop (112)

@Coder100 no i did not. You won't find it in the code now, because i decided to manually do it, but when it was there, it didn't work.

Coder100 (17136)

well it would be always false just saying @bwoop