Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python, 1.Youre given the following list: x = [5, 2, 7, 11, 44, 256, 81, 0, 36]. Write a program that takes list x

In Python,

1.Youre given the following list: x = [5, 2, 7, 11, 44, 256, 81, 0, 36]. Write a program that takes list x and makes a new list that has only the odd elements of this list in it. You should be able to write one line of code to solve it, but more lines is OK, too. 2.Write a function that takes a list of numbers (for example x = [5, 2, 7, 11, 44, 256, 81, 0, 36]) and makes a new list of only the first and last elements of the given list. Test your function. 3.Take a list, say for example, this one: x = [5, 2, 7, 11, 44, 256, 81, 0, 36] and write a program that prints out all the elements of the list that are less than 9. Instead of printing the elements one by one, make a new list that has all the elements less than 9 from this list in it and print out this new list. Write this in one line of Python, if you can figure out how.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions