0

Hey, what's eof error in Python ?

When I run the code a message appears and it says Eof error https://code.sololearn.com/cC9eA1hSa2RS/?ref=app

13th Nov 2019, 8:18 PM
Yusof
Yusof - avatar
6 Respostas
+ 1
You assign a 'str' value to "num". input() method always return a 'str' as output, so you can't comparison a 'str' with an 'int'. a = input() # a is a string b = int(input()) # b is an integer ************************** "20" < 50 ERROR! 20 < 50 True ************************** I hope this will be helpful.
14th Nov 2019, 6:22 AM
Mehran sanea
Mehran sanea - avatar
+ 1
EOFError refers to unfinished parentheses or invalid indenting.
14th Nov 2019, 7:57 AM
Seb TheS
Seb TheS - avatar
0
When you use file.read () there's no problem. But suppose you are reading the file in chunks. Then if the file would reach it's end before reading desired number of bytes then eof error will be thrown.
13th Nov 2019, 8:52 PM
Qasem
0
Qasem thank you
13th Nov 2019, 9:01 PM
Yusof
Yusof - avatar
0
Try to give all of your inputs at the beginning and in space separated form to avoid getting that error.
14th Nov 2019, 8:06 AM
Qasem