🎁BACK-TO-SCHOOL DEAL. Subscribe Now to get 40% OFF at only 8.49 USD/month, only valid until Sep 30th, 2024

Question

8.3.3: Hourly temperature reporting.

Write a loop to print all elements in hourly_temperature. Separate elements with a -> surrounded by spaces.

Sample output for the given program with input: '90 92 94 95'

90 -> 92 -> 94 -> 95 

Note: 95 is followed by a space, then a newline.

 

 

user_input = input()
hourly_temperature = user_input.split()

''' Your solution goes here '''

Asked By GalacticTraveler58 at

Answered By Expert

Carl

Expert · 1.0k answers · 1k people helped

Step 1/2

Steps to write the code is :

1. checking length of hourly_temperature is positive

2. printing the first value of hourly_temperature

3. looping from index 1 to end

4. printing the value of hourly_temperature at idnex

5. printing new line

Step 2/2

A python loop to print all elements in hourly_temperature. Separate elements with a -> surrounded by spaces is :

Final Answer

Output of the above python code is :

90 92 94 95

90 -> 92 -> 94 -> 95