
Write a Python program that reads a string as an input from the user where multiple numbers are separated by spaces. Then, make a list of numbers from the input string without using the split() function and print the list. Finally, remove all the occurences of **even numbers** from the same input list and print the modified list.
=========================================================================
**Sample Input:**
7 12 4 55 96 2 11 61 33 42
**Sample Output:**
[7, 55, 11, 61, 33]
**Hint:**
use string.split() to get a list: [7, 12, 4, 55, 96, 2, 11, 61, 33, 42]\
Then work on this list.\
You can use either a loop or list comprehension to get ther final list.
#assign the output list to variable "list_out"
def task3(str_in):
# YOUR CODE HERE
return list_out

Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images

- Write a program in python which will read an integer k from standard input. Use the list function and the range function to print a list of the even integers from -10 up to k (inclusive). Notice the form of the output is a list. NOTE: If k is less than -10, your range command should automatically produce an empty sequence, resulting in an empty list being printed. See the provided examples. For example: Input Result 5 [-10, -8, -6, -4, -2, 0, 2, 4] -11 [] 11 [-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10] 2 [-10, -8, -6, -4, -2, 0, 2]arrow_forwardImplement in python please Write a function named "sort_word" that declares a parameter for a word and returns a string with the characters from the original word in sorted order. Hint: use the built-in Python sorted() function to convert the string into a sorted list of characters, and then use a for loop to convert the list back into a string. For example, given the word "tea", you would translate it into the String "aet". and return it.arrow_forwardWrite a Python program that reads an integer N. After, read N inputs from the user and create a list of N items and print the list. Then remove the Empty strings from the list and print the new list. Sample Input: 8 hey there what's up ? Sample Output: Original List: ["hey", "there", " ", "what's", " ", "up", " ", "?"] Modified List: ["hey", "there", "what's", "up", "?"]arrow_forward
- Write a Python program that reads in several sentences terminated by newlines. Stop when the user enters a blank line. Then, print out the text entered with each word of each sentence reversed. Please note that hyphenated words count as multiple words. Punctuations attach to the word before them. Specifications• Call your program wordReverse.py• Write a function called printText. This function is going to accept a list strings and print the string. This function will:– Loop through the list one sentence at a time.– For each sentence, reverse each word in the sentence.– Once all the processing is done, print the text.• In the main function– Note that you will read a maximum of 25 rows and each row could contain 200 characters.– Read in the text from the user. Each “value” of the list is a newline terminated string. Stop when the user enters a blank line.– Call the printText function.• Please comment your code appropriately.• The text entered may contain stray whitespace.Sample RunEnter…arrow_forwardWrite a program that inputs a list of integers from the user, and removes the duplicate list elements, plus outputs their min and max values.arrow_forwardWrite a Python program including the following: a. A function that receives a list of strings as a parameter, eliminates the following stop words, and returns the resulting list: Stop words: a, an,the, punctuation symbols (.,;: ?, etc.) e.g. Original list: ["There", "is", "a", "little", "dog", "in", "the", "University", ".", "The", "little", "cat", "saw", "the", "dog", "in", "the", "University", "."] Resulting list: ["There", "is", "little", "dog", "in", "University", "little", "cat", "saw", "dog", "in", "University"]arrow_forward
- Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value. Assume that the list will always contain less than 20 integers. Ex: If the input is: the output is: 5 50 60 140 200 75 100 The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75. For coding simplicity, follow every output value by a comma, including the last one. Such functionality is common on sites like Amazon, where a user can filter results. 5 6 50,60,75, 1 #include 2 3 int main(void) { 4 78991 11 10 } const int NUM_ELEMENTS = 20; int userValues [NUM_ELEMENTS]; /* Type your code here.arrow_forwardWrite a program that receives a list of integers and prints out that list after removing prime numbers from the list. Test your program with multiple lists of numbers and make sure it works properly. For instance, if the input is [1, 2, 3, 4, 5, 6, 7], it should print [1, 4, 6]. IN PYTHONarrow_forwardplease solve these 4. Write a program that accepts a comma separated sequence of words as inputand prints the words in a sequence after sorting them alphabetically.Suppose the following input is supplied to the program:without, hello, bag, worldThen, the output should be:bag, hello, without, world 5. Write a Python program that prompts the user to enter integer values topopulate two lists, then print messages to determine the following:(a) Whether the lists are of the same length.(b) Whether the elements in each list sum to the same value.(c) Whether there are any values that occur in both lists.arrow_forward
- Looking for python guidance for the code comments. Write a program that replaces words in a sentence. The input begins with word replacement pairs (original and replacement). The next line of input is the sentence where any word on the original list is replaced. Ex: If the input is: automobile car manufacturer maker children kids The automobile manufacturer recommends car seats for children if the automobile doesn't already have one. the output is: The car maker recommends car seats for kids if the car doesn't already have one. Looking for python guidance for the code comments.arrow_forwardWrite a program in python which will read two integers, j and k, from standard input. Use the list function and the range function to print a list of integers from k down to j (inclusive). Notice the form of the output is a list. You may assume that j is less than or equal to k. For example: Input Result 2 5 [5, 4, 3, 2] 0 0 [0] -3 3 [3, 2, 1, 0, -1, -2, -3]arrow_forwardImplement a function findMixedCase in Python that: accepts a single argument, a list of words, and returns the index of the first mixed case word in the list, if one exists, (a word is mixed case if it contains both upper and lower case letters), and returns -1 if the all words are either upper or lower case. sample: >> findMixedCase( ['Hello','how','are','you'] ) # 'Hello' is mixed case0arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





