Read a sentence from the console.
Break the sentence into words using the space character as a delimiter.
Iterate over each word, if the word is a numeric value then print its value doubled, otherwise print out the word, with each output on its own line.
Sample Run:
Sentence: Hello world, there are 3.5 items.
Output:
Hello
world,
there
are
7
items. C++

Respuesta :

Answer:

Answered below

Explanation:

#Program is written in Python programming language

sentence = input ("Enter sentence: ")

list_of_words = sentence.split()

for i in list_of_words:

#check if it is a digit

if not i.isdigit( ):

print ( i, sep= "\n" )

else:

#convert string to digits and double it

number = float( i )

double = number + number

print(double, sep="\n")

In this exercise we have to use the knowledge of the python language to write the code, so we find that:

The code can be found in the attached image.

So to make it easier the code will be rewritten below as:

sentence = input ("Enter sentence: ")

list_of_words = sentence.split()

for i in list_of_words:

#check if it is a digit

if not i.isdigit( ):

print ( i, sep= "\n" )

else:

#convert string to digits and double it

number = float( i )

double = number + number

print(double, sep="\n")

See more about Python at brainly.com/question/26104476

Ver imagen lhmarianateixeira
ACCESS MORE
EDU ACCESS
Universidad de Mexico