1

Once again I am having trouble with THONNY python. What I am having trouble with this time is that you need at LEAST 40$ to buy this. But what I am doing is you have to have 40$ exactly. How can I change it so the player has at least 40$? This is what I have put:(This bit below doesnt matter***)

elif balance_a == "40" and select == "g":

What do I change?

[*** = the select == "g" part doesn't matter.] [If I am unclear please say.]

EDIT: IT WORKED THANK U! HAve a good day/night!

2 Answers2

0

As far as what I understood, you want 40 or more, if this is the case do

 elif balance_a >= 40 and select == "g":

This makes it greater than or equal to, which is the same as at least

  • You can't compare mixed types in python 3.0, and in 2.0 it gives non-intuitive results. Therefore I believe you need `balance_a >= 40` – anvoice Jan 13 '21 at 07:28
0

If I undestood your issue, this is the solution:

elif balance_a >= 40 and select == "g":`?

You have to use >= rather than =.

I assume that balance_a is a numeric type, otherwise you have to convert it:

elif float(balance_a) >= 40 and select == "g":`?
PieCot
  • 3,564
  • 1
  • 12
  • 20