+ 2

Why the error ( EOF ) when I write two or more < input > in Python3?

Why the error ( EOF ) when I write two or more < input > in Python3? For example: #calculator of area l = input("Write the length: ") a = input("Write the width: ") area = l*a print(area) ***Error*** Traceback (most recent call last): File "..\Playground\", line 4, in <module> a = input("Write the width: ") EOFError: EOF when reading a line

30th Jan 2018, 1:58 AM
>> ISAI <<
>> ISAI << - avatar
2 Réponses
+ 3
You're trying to multiply 2 strings together, which makes the Python interpreter have a mental breakdown trying to figure out what to do (not really, it just raises an error). Try setting the length and width to equal to the input as an int: l = int(input("Enter the length:") a = int(input("Enter the width:") area = l*a print(area) Also, you may not be actually entering a number when you are prompted to. Try typing in your second number on a new line, which should fix your problem. Sidenote, EOF stands for End of File which raises whenever an unexpected end of the file occurs due to some sort of input.
30th Jan 2018, 2:36 AM
Faisal
Faisal - avatar
+ 2
Ok, I see, thanks very much for your answer
30th Jan 2018, 4:17 AM
>> ISAI <<
>> ISAI << - avatar