+ 2
Beginner in problem
Code: 1 # Take the number of available spaces as an input 2 spaces = int(input()) 3 4 # Display message if spaces are available 5 if spaces >=20: 6 print("Available spaces") 7 else: 8 # Display a different message if spaces are not available 9 print("Sorry, the parking lot is full") Text of the error: The code tries to convert the input function to an integer, but it should call the function with empty parentheses to get the user input. My questions: I didn't get something, or it's a bug of the Sololearn sandbox? Can anyone explain, how to fix the problem?
11 Respuestas
+ 5
Indentation is VERY important in Python. Blocks of code need to be indented by the same number of spaces, typically 4 spaces.
https://www.geeksforgeeks.org/indentation-in-python/
+ 4
you haven't done indenting
+ 3
Key OK 👌 You should save your code in the Code Playground and share a link to it here. It makes it much easier for us to help you 👍
+ 3
Try changing '>=' to '<='. your logic was backwards 😉
+ 2
changed code:
1 # Take the number of available spaces as an input
2 spaces = int(input())
3
4 # Display message if spaces are available
5 if spaces >=20:
6 print("Available spaces")
7 else:
8 # Display a different message if spaces are not available
9 print("Sorry, the parking lot is full")
+ 2
Keith Thank you!
+ 2
I just tested the code and test case number two did not pass.
Try changing line 4 to:
if spaces>0:
+ 2
Dakota Kisiel Good job! However, keep in mind that we typically try not to post answers in the forums 😉
+ 1
Keith and it worked! Thanks!:)
0
I apologize, I done independing, but it still doesn't work for number 4, when Sololearn is testing my code, but for 0 and 10 it works, as they show