0

Python

Please I am stuck at Smart parking lot

7th Jan 2024, 6:01 PM
Prosper Jacob
Prosper Jacob - avatar
7 ответов
+ 3
You seem to have duplicated code, which is the start of the problem. You should have one if/else statement only, and pay attention to the "if" ranges. You shouldn't normally have overlapping values.
7th Jan 2024, 7:28 PM
StuartH
StuartH - avatar
+ 3
Why is there a 20 in the first if? Maybe change that to 1... and then change your second if to an elif. Comment out/remove the lines after that print statement.
7th Jan 2024, 10:06 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
1. Your first if statement should be if spaces>=0 2. Change your second if statement to an 'else' statement. 3. Finally outside of the if block, subtract 1 from available spaces.
8th Jan 2024, 12:18 AM
Keith
Keith - avatar
+ 1
If you post a link to the code you have so far, we can help with where you are going wrong
7th Jan 2024, 6:45 PM
StuartH
StuartH - avatar
+ 1
Take the number of available spaan input spaces = int(input()) # Display message if spaces are available if spaces >= 20: print("Available spaces") if spaces <= 0: print("Sorry, the parking lot is full") # Display a different message if spaces are not available elif spaces >= 0: print("Available spaces") elif spaces <= 0: print("Sorry, the parking lot is full")
7th Jan 2024, 7:23 PM
Prosper Jacob
Prosper Jacob - avatar
0
It is actually a lesson
7th Jan 2024, 7:23 PM
Prosper Jacob
Prosper Jacob - avatar
0
Please amend my mistakes
7th Jan 2024, 7:24 PM
Prosper Jacob
Prosper Jacob - avatar