0
Python
Please I am stuck at Smart parking lot
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.
+ 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.
+ 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.
+ 1
If you post a link to the code you have so far, we can help with where you are going wrong
+ 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")
0
It is actually a lesson
0
Please amend my mistakes