Question

Use while loops, for loops, and if statements only- python 3

In order to pass time during your vacation, you decided to go on a hike to visit a scenic lake up in the mountains. Hiking to

0 0
Add a comment Improve this question Transcribed image text
Answer #1

*****************************************************************************
PLEASE DO UPVOTE IF THE ANSWER IS HELPFUL AS IT GIVES THE CONFIDENCE TO HELP MORE STUDENTS
*****************************************************************************
In case If I have not answered completely, it's because Chegg allows me to answer a specific no of questions including the subparts, so please do post the rest of the questions as a separate query as per Chegg Guidelines. Thank you :)
*****************************************************************************

n = int(input())
ans = input().split()
for i in range(n):
    ans[i]= int(ans[i])
  
# print(ans)
day = 1
temp = max(ans[0], ans[2])

for i in range(1, n-2):
    if max(ans[i], ans[i+2]) < temp:
        temp = max(ans[i], ans[i+2])
        day = i+1
print(day, temp)

Reset Copy ++ +14 # # va Python 3 Shortcuts 1 n = int(input()) 2 ans = input().split() 3. for i in range(n): 4 ans[i]= int(an

Add a comment
Know the answer?
Add Answer to:
Use while loops, for loops, and if statements only- python 3 In order to pass time...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need help using python ( spyder) only use files , loops if needed is statement do not use , def...

    i need help using python ( spyder) only use files , loops if needed is statement do not use , def function or any other. Exercise 1: Daily temperature is recorded for some weeks in files (templ.txt", temp2.txt, and temp3.txt; provided in the MOODLE). The first line contains number of weeks and the rest of the lines each represent the week number followed by temperature on the seven days of that week (see samples input files below). Write a python...

  • cpp Description The purpose of this challenge is to use the for loops. This challenge uses...

    cpp Description The purpose of this challenge is to use the for loops. This challenge uses accumulators and loops. Requirements Assume you were offered a job that paid $0.01 on the first day, $0.02 the 2nd day, $0.04 the 3rd day (each day’s income is double the previous day’s income) Display what you made on each day Calculate and show how much you made in 30 days of work DO NOT USE Any power or exponentiation formulas Sample Interaction /...

  • In C++, Please help me compute the following flowchart exactly like this requirement: Use while loops...

    In C++, Please help me compute the following flowchart exactly like this requirement: Use while loops for the input validations required: number of employees(cannot be less than 1) and number of days any employee missed(cannot be a negative number, 0 is valid.) Each function needs a separate flowchart. The function charts are not connected to main with flowlines. main will have the usual start and end symbols. The other three functions should indicate the parameters, if any, in start; and...

  • Hi. Please help me solve this in python using only while loops, if statements. Can't use...

    Hi. Please help me solve this in python using only while loops, if statements. Can't use for loops and lists. In this programming assignment, you will be writing a program that prints out several shapes via text. In this PA, you will be required to use functions and parameters. This is both to reduce redundancy and to make your code clean and well-structured. Name your program shaper.py Your program should have the capability to print out three different shapes: An...

  • plz solve it using ( python) spyder. use lists, loops,,,etc not allowed( def, ...) Exercise 1...

    plz solve it using ( python) spyder. use lists, loops,,,etc not allowed( def, ...) Exercise 1 Write a Python program that reads from user the names and temperatures of n cities (n must be> 0) into two lists: a list to hold the names of the cities and another one to store the temperatures of each city. Then using these two lists, your program should find and display the following information as shown in sample output below . The average...

  • Python Testing a) The temperature readings are correctly handled using a while loop and the output...

    Python Testing a) The temperature readings are correctly handled using a while loop and the output is correct b) The wind speed readings are correctly handled using a while loop and the output is correct c) The humidity readings are correctly handled using a while loop and the output is correct d) Works correctly overall The program first prompts for and reads in temperatures (all integers), until a line with no characters in received. It computes the average of all...

  • PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program tha...

    PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program that reads a values for hour and minute from the input test file timeData.txt . The data read for valid hour and valid minute entries. Assume you are working with a 24 hour time format. Your program should use functions called validateHour and validateMinutes. Below is a sample of the format to use for your output file  timeValidation.txt :   ...

  • Please help in c++, follow the instructions, please. try to use pass by reference and pass...

    Please help in c++, follow the instructions, please. try to use pass by reference and pass by value if you could Description: Write a program that will input wind speed and temperature and output the wind-chill factor. W = 35.74 + 0.6215 ∗ T − 35.75 ∗ V 0.16 + 0.4275 ∗ T ∗ V 0.16 Your program should use at least 2 functions in addition to main. One that uses pass by reference parameters and prompts the user for...

  • Python 3 coding with AWS/IDLE. DDI&T a Python program to input, store, and process hourly temperatures for each hour...

    Python 3 coding with AWS/IDLE. DDI&T a Python program to input, store, and process hourly temperatures for each hour of the day (i.e., 24 temperatures). Your program should be divided logically into the following parts: In function main() declare an empty List container:          HourlyTemperatures = []     Pass the empty HourlyTemperatures list to a function, GetTemperatures(HourlyTemperatures)          This function must interactively prompt for and input temperatures for each of the 24 hours in a day (0 through 23). For each temperature that...

  • Use only if else nested if else only otherwise your answer won't be entertained. Problem 1(b):...

    Use only if else nested if else only otherwise your answer won't be entertained. Problem 1(b): Write a program that gives remainder without using modulus operator and loops. The first number entered will be dividend and second number entered will be divisor. Sample input: 15 6 Sample output: Remainder is 3 In a right triangle, the square of the length of one side is equal to the sum of the squares of the length of the other two sides. Write...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT