Introduction to Python - codeplayground | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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')

24th Jul 2023, 11:58 AM
Katarzyna
4 Answers
+ 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.
24th Jul 2023, 12:42 PM
Lothar
Lothar - avatar
+ 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.
24th Jul 2023, 12:11 PM
JaScript
JaScript - avatar
+ 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
24th Jul 2023, 12:25 PM
Katarzyna
+ 2
it was my mistake. first line spaces = int(input())
24th Jul 2023, 3:57 PM
Katarzyna