Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 Question 2: Write a Series of Mathematical Functions (33 pts) Write the following three functions: addTwoNumbers(a,b), which takes as input two numbers a and
2 Question 2: Write a Series of Mathematical Functions (33 pts) Write the following three functions: addTwoNumbers(a,b), which takes as input two numbers a and b and returns the result a+b multiplyTwoNumbers(a,b), which takes as input two numbers a and b and returns the result a*b . calculate(a), which takes as input one number a and uses the above functions to return the result a2 + 2 3 Question 3: Test out map and filter (33 points) a) Write a function called longStrings(L) which given a list of strings L, returns a new list containing only the strings with length longer than 5. i.e.: longStrings(['a,'b','abcde','abcdef']) -> [abcdef'] b) Write a function doubleStrings(L) which given a list of strings L, returns a new list of the same strings but doubled. i.e.: doubleStrings(['a','b','cc?]) -> ['aa', 'bb', 'cccc'] - Again, please submit this home- work as a single file containing all functions, called hw1.py
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started