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
5 Antworten
+ 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.
+ 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"]))
0
But how I can get 'a' from input data? (To convert different lists)
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.
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: ")))
===