+ 1

(Answered) Please tell me why my code is printing vertically instead of horizontally.

7th Sep 2020, 6:35 AM
Hyperion
Hyperion - avatar
7 Antworten
+ 9
x = input().split() is all you need for the first line (try it 😊). split() generates a list by itself, so you don't need a list comprehension. Also, input() always generates a string, so you don't need str().
8th Sep 2020, 1:52 AM
David Ashton
David Ashton - avatar
+ 2
Check if your code has a new line character after every character/string/number in your print function
7th Sep 2020, 8:36 AM
Kkristina
Kkristina - avatar
+ 2
and end=" " in print, because default is end="\n" print(new_word + first_letter + "ay", end = " ")
7th Sep 2020, 9:22 AM
Jayakrishna 🇮🇳
+ 2
Thanks
8th Sep 2020, 4:12 AM
Hyperion
Hyperion - avatar
+ 1
x = [str(x) for x in input().split()] for words in x: first_letter = words[0] new_word = words[1:] print(new_word + first_letter + "ay")
7th Sep 2020, 8:58 AM
Hyperion
Hyperion - avatar
+ 1
Thanks
7th Sep 2020, 9:54 AM
Hyperion
Hyperion - avatar