0
Need help with this problem.
I am trying to take first letter of each word and put it at the end of the same word . I think i am close but some thing is off i dont know where . This is my code : a = 'arm am max' b = list (a.split (' ')) c = "" for j in b : list = list (j) first = list.pop (0) list.append (first) string = str ( list ) c += string print (string )
10 Antworten
+ 3
1. The split function already returns a list, so no need of adding that 'list()'
2. Don't use the name 'list' as it is already a function! Use another variable name like 'l' or 'lst'
3. Don't use the str tag with lists,
str([1,2,3]) => [1,2,3] and here the second element is not 2 but it is 1 and similarly the third element is ,
So instead use print ("".join(['1','2','3'])) which will give => 123
4. At the last you should print c and not string. With every loop add a space " " to the variable c
5. I really liked your approach with pop function!👍🙌 keep it up!
Here's a one liner solution for pig latin
https://code.sololearn.com/cy5AZdpsxNvn/?ref=app
+ 2
Max Lwe to whom?
+ 1
no need for too much line of code!
a="I can do it all day"
b=''.join(i[1:]+i[:1]+" " for i in a.split(" "))
+ 1
You sure? Koay hentay. appyhay odingcay!
+ 1
😁 this is not indian! This Is Spart... Khm... This is pig latin. You know what I mean bro? Hint: Code coach
+ 1
Happy coding 😅😅
0
Can you please explain ur code .
It will make my day.
0
Nevermind i got it thanks for your help.
0
I am not Iindian bro
0
Thanks