Getting errors | SoloLearn: Learn to code for FREE!

+1

Getting errors

Write a Python script, that takes name, surname and title of a person and displays the inputs in a different format: Enter name: Ihsan Enter surname: Dogramaci Enter title: Professor Person is: Prof. Dogramaci, I. Enter name: Hilmi Enter surname: Oncul Enter title: Instructor Person is: Inst. Oncul, H. My attempt was: Name= input ("Enter name: ") Surname= input("Enter surname: ") Title= input ("Enter title: ") print ("Person is:{0:.4s}. {1:s} {2:.1s}.".format(Title,Surname,Name) (But I kept on getting an error that says unexpected EOF while parsing)

9/29/2020 12:18:12 PM

Sara Maskoun

3 Answers

New Answer

+4

Hi Sara Maskoun, As Jayakrishna🇮🇳 said, you are getting SyntaxError due to missing ')'. The following code achieves the same result without the use of .format(). I've used basic print() function and slicing methods... https://code.sololearn.com/c4dQMN42xmL7/?ref=app

+3

Using f-string makes it easy to get a proper output. it has a better readability than using .format() Name= input ("Enter name: ") Surname= input("Enter surname: ") Title= input ("Enter title: ") print(f'Person is: {Title[0:4]}. {Surname} {Name[0]}.')

+2

You are missing closing brace for last print function. Sara Maskoun add ) last. And SoloLearn takes all the inputs at once only and also before start of execution... So you need to give all the required input only ones beginning.. Edit: For additional info, if you don't know, See this, for how SoloLearn handle input : https://code.sololearn.com/WhiNb9BkJUVC/?ref=app