0

Create a function to convert arguments in the array into a sentence.

Please help, guys! The function must be: 1. The proposal should begin with a capital letter. 2. At the end of the sentence should melt point. 3. Between words should be blank. 4. Do not perform any other operations on words. Example: Entrance: ["i", "am", "the", "God"] Exit: "I am the God" https://code.sololearn.com/cCqUodAFQUw8/#py

1st Aug 2018, 6:09 AM
Arthur P
Arthur P - avatar
5 Respostas
+ 1
>>> a =["i", "am", "the", "God"] >>> a[0] = a[0].capitalize() >>> print(" ".join(a)) I am the God ===== I am not sure what did you mean by melting point.
1st Aug 2018, 6:42 AM
strawdog
strawdog - avatar
+ 1
Max Rubs Make a function then call it whenever you need: def cnv(lst): lst[0] = lst[0].capitalize() return " ".join(lst)+'.' print(cnv(["i", "am", "the", "God"]))
1st Aug 2018, 3:03 PM
strawdog
strawdog - avatar
0
But how I can get 'a' from input data? (To convert different lists)
1st Aug 2018, 1:46 PM
Arthur P
Arthur P - avatar
0
I meant if I want to get data from input: (Aim of the function is not to convert just one phrase, but any other, which would be entered with input). def some_func(input): The function must offer input! (sorry for bad English) and just after this convert with capitalizing.
1st Aug 2018, 8:36 PM
Arthur P
Arthur P - avatar
0
This would do the trick: def cnv(phraze): lst = phraze.split() lst[0] = lst[0].capitalize() return " ".join(lst)+'.' print(cnv(input("Enter a phraze: "))) ===
2nd Aug 2018, 7:11 AM
strawdog
strawdog - avatar