+ 1
Introduction to Python - codeplayground
Hi guys, I have a problem with the "Smart Parking Lot" exercise. Could you help me what is wrong with my code? spaces = 20 if spaces > 0: print('Available spaces') else: print('Sorry, the parking lot is full')
4 Antworten
+ 6
Katarzyna ,
the task description is a bit poor in this case, since it does not mention that we have to get an input from the user. [edited: it is mentioned in the given code to take input from the user]
replace the line:
spaces = 20 # which is hard coded
and use the input() function and store the input in the variable *spaces*. don't forget to convert the input to an integer value.
+ 5
I don‘t know this task, but that seems to be fine. Once the spaces has to be getting with input statement and convert to number.
+ 2
thank you, I thought also that it's ok, but sololearn says that it's bug. I don't have any idea where.
my task:
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
input example output
space = 20 Available spaces
space = 0 Sorry, the parking lot is full
+ 2
it was my mistake.
first line
spaces = int(input())