Question: Write a loop to print all elements in hourly_temperature. Separate elements with a -> surrounded by spaces. Sample output for the given program: (must be

Write a loop to print all elements in hourly_temperature. Separate elements with a -> surrounded by spaces. Sample output for the given program: (must be in python)

90 -> 92 -> 94 -> 95 

Note: There is a space after 95.

------------------------------------------------------------------------------------------------------------------------

hourly_temperature = [90, 92, 94, 95]

for temp in hourly_temperature: for index,temp in enumerate(str(temp)): if index != len(temp)-1: print(temp,'->',end=' ') else: print(temp, end='')

print('') # print newline

------------------------------------------------------------------------------------------------------------------------

My expected out is:

90 -> 92 -> 94 -> 95

I keep getting:

90 -> 92 -> 94 -> 95 ->

NOTE: I can't edit the last line "print('') #print newline"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!