Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[l]: [2]: [3]: [4]: a) [10 pts] Define a function called is_even that takes an integer as a parameter and returns True if the given

image text in transcribed
[l]: [2]: [3]: [4]: a) [10 pts] Define a function called is_even that takes an integer as a parameter and returns True if the given integer is Even. A integer is said to be even if the modulo(%) of the integer equals 0 . For example, 4 is even (4%2 = 0), but 5 is not (5%2 =1). #INSERT YOUR ANSWER HERE. b) [10 pts] Modify the is_even function you created in Q1.a to take a floating-point number as an input and return True if the ceiling of the input is Even. For example, 12 . 5 is not even, but 11 . 25 is even. #INSERT YOUR ANSWER HERE. c) [10 pts] Define a function called is_even_vec that calls is Even function you updated in Q1.b to take a list of floating-point or integer numbers and return their results in a list. For example, given [1441. 25, 231. 5, 23] the function returns [True, True, False] #INSERT YOUR ANSWER HERE. d) [10 pts] Define a function called is_even_dict that calls is_even_vec and returns the results in a dictionary with their corresponding input elements. For example, given [1441.25, 231.5, 23] the function returns {1441.25: True, 231.5: True, 23: False} #INSERT YOUR ANSWER HERE. e) [10 pts] Define a function called isEvenTuple by modifying the function you created in Q1.d to traverse the values of the returned dictionary in reverse order and return the dictionary keys that have a TRUE value as a tuple. For example, given [1441 .25, 231. 5, 23] the function returns (231.5, 1441.25)

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

Mathematical Analysis For Quantitative Finance

Authors: Daniele Ritelli, Giulia Spaletta

1st Edition

1351245104, 9781351245104

More Books

Students also viewed these Mathematics questions

Question

Evaluate projects using the unadjusted rate of return.

Answered: 1 week ago

Question

1. Background knowledge of the subject and

Answered: 1 week ago