12 Antworten
+ 3
# Take the number of available spaces as an input
input = 20
spaces = int(input)
# Display message if spaces are available
if spaces > 0:
print("Available spaces")
# Display a different message if spaces are not available
else:
print("Sorry, the parking lot is full")
+ 3
# Take the number of available spaces as an input
spaces = 20
spaces = int(input())
# Display message if spaces are available
if spaces > 0 and spaces <= 20:
print("Available spaces")
# Display a different message if spaces are not available
else:
print("Sorry, the parking lot is full")
+ 2
Could you show your attempt 🤔
+ 2
Andriamavo Tianarivo Rabenjamina
Can you also provide a description of the task please.
Meantime
1. int(input()) # integer input syntax
2. Don't use input as a variable
3. I think you need to review your comparison section against the task description
+ 2
Problem solved, thank you for your help.
+ 1
The description of problem an task are:
A smart parking lot displays different messages to the visitor based on the number of available spaces.
Task
Complete the program to inform the user about available spaces in the parking lot
Thank you fo your help.
+ 1
Try to understand the code first, then try doing it yourself, if you are still stuck, provide the link to your code and provide an explanation of what you want to do and what have you done.
+ 1
This is the right code
# Take the number of available spaces as an input
spaces = 20
spaces = int(input())
# Display message if spaces are available
if spaces > 0 and spaces <= 20:
print("Available spaces")
# Display a different message if spaces are not available
else:
print("Sorry, the parking lot is full")
0
Andriamavo Tianarivo Rabenjamina
Well done buddy!
0
A smart parking lot displays different messages to the visitor based on the number of available spaces.
Task
Complete the program to inform the user about available spaces in the parking lot
0
The correct Code to this is:
# Take the number of available spaces as an input
spaces = int(input())
# Display message if spaces are available
if spaces > 0 and spaces <= 20:
print("Available spaces")
else:
print("Sorry, the parking lot is full")
0
# Take the number of available spaces as an input
spaces = 20
spaces = int(input())
# Display message if spaces are available
if spaces > 0 and spaces <= 20:
print("Available spaces")
# Display a different message if spaces are not available
else:
print("Sorry, the parking lot is full")