-5

I want the output value to be

jeong
si
sook
2017

when I enter jeong si wook 2017.

But there's always been a problem. why?? help me please...

name1, name2, name3, si = input("Name and School ID: ").split
print(name1 \n name2 \n name3 \n si)
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
정시욱
  • 17
  • 2

1 Answers1

0

I think the problem you are dealing with is you do not take input correctly. In your current approach, user has to pass a string(""), and also print() is expecting a string to be printed out.

So in order for your function to work, you need to modify your print() to print(name1 + "\n" + name2 +"\n" + name3 +"\n" +id), this will first convert the being print content to a string "name1 + \n + name2 + \n + name3 +\n +id" then outputs it.

Hope this solves your problem and confusion, good luck!

"\n" and some other "\r" etc are special instruction for output operations. "\n" means new line in this case, in your case, shouldn't it just be print("your stand input")?

Guang Mo
  • 26
  • 3
  • I don't understand what you're saying... sorry... it's because i 'm not good enough yet. – 정시욱 Apr 07 '19 at 07:13
  • dont say sorry on this, it will get better when you spend more time in this area. In programming languages, it needs specially handling to pass inputs and outputs. There are commonly applicable across different languages, C, C++, Perl, Python. For example, "\n" means new line, "\t" means tab, things after "\" will be evaluated for special instructions first. Now, I see you rephrased the question, and see my edited post shortly. – Guang Mo Apr 07 '19 at 16:30