Can anyone help me please in making a python program for printing the middle name of an entered name. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone help me please in making a python program for printing the middle name of an entered name.

Python programs.

24th Oct 2019, 4:28 AM
Shreeyansh Singh
Shreeyansh Singh - avatar
3 Answers
+ 3
print(input().split()[1])
25th Oct 2019, 3:08 AM
David Ashton
David Ashton - avatar
+ 2
Hints: โ— Get input and act properly when it is empty. โ— Split the input by space. โ— See if there's exactly 3 parts produced by splitting. Notify user for invalid input when there's less than or more than 3 parts resulted by split. โ— Return the second part of the split result.
24th Oct 2019, 6:45 AM
Ipang
0
Could u plz help me by giving the codes.!! And Md Sahil we have to get name inputed so we don't have idea about the index!! Or could u help me with code!! Thankyou๐Ÿ˜€๐Ÿ˜€
24th Oct 2019, 5:16 PM
Shreeyansh Singh
Shreeyansh Singh - avatar