Question: 1 ) i ) Write a Python function calculate ( a , b ) that takes two numbers and returns their sum, difference, product, and
i Write a Python functioncalculatea bthat takes two numbers
and returns their sum, difference, product, and quotient. Print the
results.
def calculatea b:
# Your code here Marks
ii Write a functionisevennumthat takes an integer and
returnsTrueif the number is even andFalseif it is
odd.
def isevennum:
# Your code here Marks
iii Create a list of integers. Write a functionfilterevennumberslstthat
returns a new list containing only the even numbers from the original
list.
def filterevennumberslst:
# Your code here Marks
iv Create a dictionary containing the names and ages of people. Write a
functiongetaverageagepersondictthat calculates and
returns the average age.
def getaverageagepersondict:
# Your code here Marks
Create a NumPy array of random integers between and Write a
functionarraystatisticsarrthat returns the mean, median,
and standard deviation of the array.
import numpy as np
def arraystatisticsarr:
# Your code here Marks
Ensureyour code runs without errors.
Write comments explaining each part of your code.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
