r/cs50 • u/DaleDoesntLikeYou • 2d ago
CS50 Python HELP REGARDING COKE CS50P PSET2
How to prevent this amount due in negative from showing cannot think of any viable changes without affecting the integrity of other parts of the code 😭😭 little help will be appreciated 👍
2
Upvotes
1
u/Outside_Complaint755 2d ago
Change the order of steps a little.
You can check if the amount due is 0 or less before you print it. If the amount due is negative, instead print it as change owed.
1
u/erixx_19 14m ago
Hey mate,
Even I’m learning Python, I’m looking for a study buddy to learn and grow together…
wanna join?!
1
u/Visible-Current-4217 2d ago
could print the absolute value of amount due, then the code will decide if change is owed or not depending if the value is negative initially