-2

Just started an intro to scripting class using Python. My first lab is giving me problems with the EOFError: EOF when reading a line. This is everything I had entered as my input.

    first_name = input('Kevin')
    generic_location = input('Target')
    whole_number = input('8')
    plural_noun = input('socks')
    print(first_name, 'went to', generic_location, 'to buy', whole_number, 'different types of', 
    plural_noun)

Not sure how to fix it??

  • Welcome to SO! Please take the [tour]. Once you fix the indenting, it runs just fine, but it looks like you put the data where the input prompts should go. What's your desired output? Please [edit] to clarify. See [ask] if you want more tips. – wjandrea May 06 '21 at 02:14
  • On second thought, it looks like you're not even supposed to use `input()` here. Try `first_name = 'Kevin'`, etc. (I'm guessing you're running this in some script runner which doesn't actually provide any input on stdin.) – wjandrea May 06 '21 at 02:16
  • Related: [Python 3: EOF when reading a line (Sublime Text 2 is angry)](https://stackoverflow.com/q/12547683/4518341) – wjandrea May 06 '21 at 02:19
  • Awesome that fixed it! – Kevin Allmon May 06 '21 at 02:20
  • OK, great! I posted an answer, which is mostly a formality at this point – wjandrea May 06 '21 at 02:24

1 Answers1

0

Once you fix the indenting, it runs just fine, but it looks like you're not supposed to use input() here. (I'm guessing you're running this in some script runner which doesn't actually provide any input on stdin.)

first_name = 'Kevin'
generic_location = 'Target'
whole_number = '8'
plural_noun = 'socks'
print(first_name, 'went to', generic_location, 'to buy', whole_number, 'different types of',
      plural_noun)

Output:

Kevin went to Target to buy 8 different types of socks

(Indenting the last line is not necessary, but it's good style.)

wjandrea
  • 28,235
  • 9
  • 60
  • 81