Question

Week 10 - Pob 1[Lists] / 1. POD 1: Data bounded Instructions Today we will carry on looking at lists. You will be given a lis
5 points pc MW data: (11,2,3,41 threshold: 3 data: [121,22,443, 4, 217] threshold: 100 data: 199,11,83,22,77,33, 66, 44,551 t
pod.py textfilel.txt textfile2.txt textfile3.txt New I Full S. 2 # CSCI 1105 3 # Week 9, POD 3 (Loops & lists) 4 # @author: ?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please Refer to the code below:

def greater_than_threshold(li, threshold):
    # Iterating in loop
    for i in li:
        # checking if threshold is greater than the value on list
        if i > threshold:
            # printing value
            print(i)
# This is the function which you can append in your code at the top

# Driver Code
print("Enter list:")
# taking list as input with comma seperated values
li = list(map(int, input().split(',')))
# taking threshold as input
threshold = int(input("Enter threshold value: "))
# Calling function for output
greater_than_threshold(li, threshold)

# This is how you call the function passing your list in place of li and your threshold value in place of threshold

Output:-

Enter list:
11,2,3,4
Enter threshold value: 3
11
4

Enter list:
121,22,443,4,217
Enter threshold value: 100
121
443
217

Enter list:
99,11,88,22,77,33,66,44,55
Enter threshold value: 50
99
88
77
66
55

==============================================

Please Refer to the images below:-

1 Edef greater than threshold(li, threshold) : # Iterating in loop = for i in li: # checking if threshold is greater than theEnter list: 11,2,3,4 Enter threshold value: 3 11 4

Enter list: 121,22,443,4,217 Enter threshold value: 100 121 443 217

Enter list: 99,11,88,22,77,33,66,44,55 Enter threshold value: 50 99 88 66

======================================

Please Upvote, Thank You

======================================

Add a comment
Know the answer?
Add Answer to:
Week 10 - Pob 1[Lists] / 1. POD 1: Data bounded Instructions Today we will carry...
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
  • PoD 4: Greetings all around! Instructions Good day! Bonjour! Good evening! Bonsoir! You are in a...

    PoD 4: Greetings all around! Instructions Good day! Bonjour! Good evening! Bonsoir! You are in a bilingual country! A nice thing to know is how to greet people in any language. You are going to write a program to make sure that we know how to greet the peoples around us. The French word "Bonjour" means "Good day. This is greeting can be used from morning until dusk (let's 18:00 or 6pml. After dusk we might say "Bonsoir" or "Good...

  • Instructions We will carry on working with functions! Once more, all input and output has been...

    Instructions We will carry on working with functions! Once more, all input and output has been taken care of for you. All you need to do is finish off the function tableMin that finds the minimum value within a table (2-D list). Details Input Input has been handled for you the list has been populated. It reads in N as well as the data needed to fill an NxN integer table. Processing Complete the tableMin function. Note that you have...

  • //LinkedList import java.util.Scanner; public class PoD {    public static void main( String [] args )...

    //LinkedList import java.util.Scanner; public class PoD {    public static void main( String [] args ) { Scanner in = new Scanner( System.in ); LinkedList teamList = new LinkedList(); final int TEAM_SIZE = Integer.valueOf(in.nextLine()); for (int i=0; i<TEAM_SIZE; i++) { String newTeamMember = in.nextLine(); teamList.append(newTeamMember); } while (in.hasNext()) { String removeMember = in.nextLine(); teamList.remove(removeMember); }    System.out.println("FINAL TEAM:"); System.out.println(teamList); in.close(); System.out.print("END OF OUTPUT"); } } =========================================================================================== //PoD import java.util.NoSuchElementException; /** * A listnked list is a sequence of nodes with...

  • C++ You're given the pointer to the head nodes of two linked lists. Compare the data...

    C++ You're given the pointer to the head nodes of two linked lists. Compare the data in the nodes of the linked lists to check if they are equal. The lists are equal only if they have the same number of nodes and corresponding nodes contain the same data. Either head pointer given may be null meaning that the corresponding list is empty. Input Format You have to complete the int CompareLists (Node headA, Node* head B) method which takes...

  • 1. Make a function make_list_of_lists(n, m) that creates and returns a list of n lists of...

    1. Make a function make_list_of_lists(n, m) that creates and returns a list of n lists of size m, where each of the m elements in a sublist are randomly generated integers between 1 and 9. For example, you might obtain l = make_list_of_lists(2,2) >>> print(l) [[1, 4], [5, 7]] Big Hint: You can do this using numpy along the lines of the following code: import numpy >>> l = list(numpy.random.randint(a,b,c)) where you need to sort out what the values of...

  • Can you make simple code of this using C++ In-lab Final Exam Ideas: Following are the possible topics for the in-lab final exam for next week. These all assume that we have: struct Node int data...

    Can you make simple code of this using C++ In-lab Final Exam Ideas: Following are the possible topics for the in-lab final exam for next week. These all assume that we have: struct Node int data; Node 'pNext; and in main we have: Node "pHead = NULL; // pointer to the head of the list Node·pTemp: // Used to get new nodes Node "pHeadA NULL: Node "pHeadB = NULL; We will also provide for you the code that is used...

  • Using c 3 File Input & Data Processing Reading data from a file is often done in order to pro...

    using c 3 File Input & Data Processing Reading data from a file is often done in order to process and aggregate it to get ad- ditional results. In this activity you will read in data from a file containing win/loss data from the 2011 Major League Baseball season. Specifically, the file data/mlb_nl_2011.txt contains data about each National League team. Each line contains a team name fol- lowed by the number of wins and number of losses during the 2011...

  • In the lectures about lists we have seen some Python code examples that involve the processing of...

    In the lectures about lists we have seen some Python code examples that involve the processing of lists containing weather statistics. The original source of the values shown in the slides was taken from part of the Environment Canada website that serves up historical data: http://climate.weather.gc.ca/historical_data/search_historic_data_e.html    Data can be provied by that website using the Comma Separated Value (CSV) format which is stored in text files normally using a CSV suffix. We will not work directly with such files in...

  • Programming Assignment 1 Data structure Java Implement Shellsort for a linked list, based on a variant...

    Programming Assignment 1 Data structure Java Implement Shellsort for a linked list, based on a variant of bubble sort. The rather severe constraints imposed by the singly-linked list organization presents special problems for implementing Shellsort. Your task is to overcome these constraints and develop a simple, elegant implementation that does not sacrifice efficiency or waste space. Step 1. First, implement a routine to build a list: read integers from standard input, and build a list node for each item consisting...

  • 1. The Cool Clothing Company is developing a new computer order processing system to process mail...

    1. The Cool Clothing Company is developing a new computer order processing system to process mail order sales of its products. Customers send in their orders, by email, together with a credit card payment. Availability of the ordered goods is then checked in an inventory file; then the validity of the credit card payment is checked online to customer's bank. If these two checks are successful, a dispatch paid order is sent to the customer and warehouse. The warehouse is...

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