Question

IN PYTHON Implement a function called printGreater() that accepts a list of numbers numLst and a...

IN PYTHON

Implement a function called printGreater() that accepts a list of numbers numLst and a number num. The function then iterates through the lst printing all numbers in the list that are greater than num. The results need to be printed on one line.

>>> printGreater([200, 45, 270, 3, 7, 1000, 385, 20], 50)

200 270 1000 385

>>> printGreater([], 50)

>>>

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

Thanks for the question, here is the function, do let me know if you need any other help

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

def printGreater(numLst,num):

    for number in numLst:
       if number>num:
            print(number,end=' ')

printGreater([200,45,270,3,7,1000,385,20],50)

printGreater([],50)

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

Add a comment
Know the answer?
Add Answer to:
IN PYTHON Implement a function called printGreater() that accepts a list of numbers numLst and a...
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
  • IN PYTHON Implement a function printSeqs() that accepts a list of name lst and prints the...

    IN PYTHON Implement a function printSeqs() that accepts a list of name lst and prints the following sequences. The sequences are printed by the for loops found in the function. The information below shows how you would call the function printSeqs() and what it would display: Write a for loop that iterates through a list of names and print a greeting for each name in the list. Request from the user a positive integer n and prints all the positive...

  • #Python 1.Write a function called difference() that accepts a list of numbers from the user and...

    #Python 1.Write a function called difference() that accepts a list of numbers from the user and returns the difference between the largest and the smallest numbers in the list as follows: >>> difference() Please enter a list: [100, 102, 106, -10] 116 >>> difference() Please enter a list: [1,2,3,4,5,6,7,8,9,10] 9 >>>

  • PYTHON CODE In a program, write a function that accepts two arguments: a list, and a...

    PYTHON CODE In a program, write a function that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all of the numbers in the list that are greater than the number n. Output should look like: Number: 5 List of numbers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] List of numbers that are larger than 5: [6, 7, 8, 9, 10]

  • python In a program, write a function that accepts two arguments: a list, and a number...

    python In a program, write a function that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display the number n, the list of numbers, and a sub list of all the numbers in the list that are greater than the number n. Initialize the list and the number n in the main function of your code and call your function, passing the list and number as arguments. Run your code...

  • PYTHON: Using Lists and Arrays! 5. In a program, write a function that accepts two arguments:...

    PYTHON: Using Lists and Arrays! 5. In a program, write a function that accepts two arguments: a list, and a number n. The program should generate 20 random numbers, in the range of 1 through 100, and assign each number to the list. The program should also ask the user to pick a number from 1 through a 100 and assign that number to n. The function should display all of the number in the list that are greater than...

  •    PYTHON --create a function that accepts a list of numbers and an int that returns...

       PYTHON --create a function that accepts a list of numbers and an int that returns index of 2nd occurrence of the int in list, otherwise returns None if # does not repeat more 2 or more times EX: [10,24,3,45,10,49,4,5], 10) returns 4 --create a function that accepts a string that returns true if every letter of the alphabet can be found at least one time in the string, (has to be the lowercase alphabet), and false otherwise.    for...

  • ***PYTHON 3*** We are going to practice building some simple lists. Create a function called create_list....

    ***PYTHON 3*** We are going to practice building some simple lists. Create a function called create_list. It takes 2 parameters, start and end both are integers. This function should return a list that contains all the numbers from start, to end inclusive. So you'll need a loop to count and just append that number into your list and return it. (5 pts ) lst = create_list(5, 10) lst would be [5, 6, 7, 8, 9, 10] It should be able...

  • write a Python function that takes in a list of integers and returns maximum and minimum values in the list as a tuple

    1 write a Python function that takes in a list of integers and returns maximum and minimum values in the list as a tuple. Hint (can be done in one pass, you are not allowed to use built-on min and max functions.)max, min = find_max_min(my_list):2 write a Python function that takes in a list of integers (elements), and an integer number (num). The functions should count and return number of integers in elements greater than, less than, and equal to...

  • Python Question? Write a function called reverse(user_list, num = -1) that takes a list and a...

    Python Question? Write a function called reverse(user_list, num = -1) that takes a list and a number as parameters. The function returns a copy of the list with the first number of items reversed. Conditions: The number parameter must be a default argument. -      If the default argument for number is given in the function call, only the first number of items are reversed. -      If the default argument for number is not provided in the function call, then the...

  • 5. Write a Python function called readlinesmton that accepts the name of the file (i.e. filename),...

    5. Write a Python function called readlinesmton that accepts the name of the file (i.e. filename), starting line number i.e. m) and ending line number (i.e. n) as a parameter. The function then returns the contents from line number m to n (m <n). If m < 1 then start from line 1. Similarly, if n > number of lines the file, then stop at the last line in the file. Sample Input: readlinesmton("data.txt",5,7) Sample Input: readlinesmton("data.txt", 0,10)

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