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...

  • 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...

  • 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 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...

  • 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 :   ...

  • 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...

  • Need to use Python string formatting to align wind-chill values in equal-sized columns Using your knowledge...

    Need to use Python string formatting to align wind-chill values in equal-sized columns Using your knowledge of loops and other Python features covered so far, write a program that prints a table of windchill values, where: Rows represent wind speed for O to 50 in 5 mph increments Columns represent temperatures from -20 to +60 in 10-degree increments Your program should include a function that returns windchill for a given combination of wind speed & temperature, using this formula from...

  • 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...

  • In this Final program you are going to use several concepts you learned in CSC 101...

    In this Final program you are going to use several concepts you learned in CSC 101 class, especially operations on or using FILES , LOOPS and FUNCTIONS. You need to implement C++ code that will read data from a file and process it as outlined below and write the processed data to an output file. You can refer to the file input.txt for how the data is made available to you and output.txt for how to write out the processed...

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
ADVERTISEMENT