0

there seems to be an EOFError in my code

def books(): return "0.Fantasy, 1.Science_Fiction, 2.Historical_Fiction, 3.Mystery, 4.Horror, 5.Romance_Novel, 6.Literary_Fiction, 7.Memoir, 8.Thriller, 9.Adventure_Fiction, 10.Magical_Realism, 11.Children's_Literature, 12.Contemporary_Fantasy, 13.Dystopian_Fiction, 14.Young_Adult, 15.Fairytale, 16.Fiction, 17.Romantic_Suspense, 18.Women's_Fiction, 19.Graphic_Novels, 20.History, 21.Short_Story, 22.Crime_Fiction, 23.Erotic_Romance_Novels" print("Are you a BOOKS/NOVELS person? TRUE or FALSE!") ans1 = str(input()) print( ans1.capitalize() ) if ans1 == "True": print(books()) elif ans1 == "False" : print("Oh!No worries.")

16th Sep 2024, 7:30 AM
Hafsa Ahmed
Hafsa Ahmed - avatar
4 odpowiedzi
+ 2
Hafsa Ahmed , what you could improve is this line (no error at all): ans1 = str(input()) > input() does not needed to be converted to string since input() function returns a string by default.
16th Sep 2024, 6:46 PM
Lothar
Lothar - avatar
+ 2
Hafsa Ahmed , i took your code as it is and ran it in playground without any error. both inputs (`True` or `False`) are possible. > the description `... still an error...` is very vague. please describe what input you are using and what the issue exactly is. without this information we can only guess what the problem might be.
28th Sep 2024, 1:59 PM
Lothar
Lothar - avatar
+ 1
This code runs fine.
16th Sep 2024, 11:59 AM
Jerry Hobby
Jerry Hobby - avatar
0
there's still an error even when i changed it to ans = input()
28th Sep 2024, 4:52 AM
Hafsa Ahmed
Hafsa Ahmed - avatar