+ 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?

1st Jan 2024, 12:55 PM
🇺🇦 Key OK 👌
🇺🇦 Key OK 👌 - avatar
11 ответов
1st Jan 2024, 9:37 PM
🇺🇦 Key OK 👌
🇺🇦 Key OK 👌 - avatar
+ 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/
1st Jan 2024, 1:44 PM
Keith
Keith - avatar
+ 4
you haven't done indenting
1st Jan 2024, 1:15 PM
Kaushiki Srivastava
Kaushiki Srivastava - avatar
+ 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 👍
1st Jan 2024, 9:35 PM
Keith
Keith - avatar
+ 3
Try changing '>=' to '<='. your logic was backwards 😉
1st Jan 2024, 9:46 PM
Keith
Keith - avatar
+ 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")
1st Jan 2024, 1:17 PM
Kaushiki Srivastava
Kaushiki Srivastava - avatar
+ 2
Keith Thank you!
1st Jan 2024, 9:53 PM
🇺🇦 Key OK 👌
🇺🇦 Key OK 👌 - avatar
+ 2
I just tested the code and test case number two did not pass. Try changing line 4 to: if spaces>0:
1st Jan 2024, 9:55 PM
Keith
Keith - avatar
+ 2
Dakota Kisiel Good job! However, keep in mind that we typically try not to post answers in the forums 😉
3rd Jan 2024, 12:25 AM
Keith
Keith - avatar
+ 1
Keith and it worked! Thanks!:)
1st Jan 2024, 10:12 PM
🇺🇦 Key OK 👌
🇺🇦 Key OK 👌 - avatar
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
1st Jan 2024, 9:28 PM
🇺🇦 Key OK 👌
🇺🇦 Key OK 👌 - avatar