Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in python programming 1. Countdown - Create a function that accepts a number as an input. Return a new list that counts down by one,

in python programming

1. Countdown - Create a function that accepts a number as an input. Return a new list that counts down by one, from the number (as the 0th element) down to 0 (as the last element).

  • Example: countdown(5) should return the list: [5,4,3,2,1,0]

2. Print and Return - Create a function that will receive a list with two numbers. Print the first value and return the second.

  • Example: print_and_return([1,2]) should print 1 and return 2

3. First Plus Length - Create a function that accepts a list and returns the sum of the first value in the list plus the list's length.

  • Example: first_plus_length([1,2,3,4,5]) should return 6 (first value: 1 + length: 5)

4. This Length, That Value - Write a function that accepts two integers as parameters: size and value. The function should create and return a list whose length is equal to the given size, and whose values are all the given value.

  • Example: length_and_value(4,7) should return [7,7,7,7]
  • Example: length_and_value(6,2) should return [2,2,2,2,2,2]

5. Values Greater than Second (Optional) - Write a function that accepts a list and creates a new list containing only the values from the original list that are greater than its 2nd value. Print how many values this is and then return the new list. If the list has less than 2 elements, have the function return False.

  • Example: values_greater_than_second([5,2,3,2,1,4]) should print 3 and return [5,3,4]
  • Example: values_greater_than_second([3]) should return False

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

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions