Question: Lab Questions 1. Write a Python program stored in a file L4q1.py that : A. Gets a number as an input from the user and

 Lab Questions 1. Write a Python program stored in a file

Lab Questions 1. Write a Python program stored in a file L4q1.py that : A. Gets a number as an input from the user and stores it in a variable. That number represents the length of a list. The program should then keep prompting until the user enters a valid number which is less than 10, and greater than 2. B. Creates a list where the user enters each entry in the list (explicitly convert each entry to type int). An entry is considered valid only if it is strictly greater than 0. If the entry is not valid, then the program should re-run from the invalid entry index, until valid entries are entered by the user. C. Gets a target number as an input from the user, and prints any two distinct list entries (values and indices) whose sum is equal to the target number. If no such entries are found then it should print a message stating that fact

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!