Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 . greatestOfFour ( w , x , y , z ) - Function returns the greatest of four numbers w , x , y
greatestOfFour w x y z Function returns the greatest of four numbers w x y and z and return it Sample code:
# Function Name: greatestOfFour
# Desc: Finds greatest of numbers
# Parameters: num int, num int, num int, num int
# Return: int
def greatestOfFournum num num num: if numnum and numnum and numnum:
return num
elif numnum and numnum:
return num elif numnum: return num
else: return num # Read Input
printEnter four numbers to check the greatest: num inputst num:
num inputnd num:
num inputrd num:
num inputth num:
# Call function for Process and Output
printGreatest of numbers:
printgreatestOfFourintnum intnum intnum intnum
Output:
reverseSentencesentence Function that returns the reverse of a given sentence words entered by user.
listOddn n Function to return list of all the odd numbers between two numbers.
calculateTotalSalarymonthsal, noofyears Function returns the computed total salary based on monthly salary and number of years. If the number of years is greater than years, an increment of
is added to the total salary from th year.
listMaxnumList Function returns the maximum from a list of numbers.
profitorlosscostprice,sellingprice Function returns the calculated actual profit or loss based on
cost price and selling price using the formula, Profit Selling Price Cost Price and Loss Cost Price
Selling Price
printEveIndexCharstr Function that returns only those characters which are present at an even index
number in a given String.
rentalcarcostrateperday, noofdays Function that returns the calculated cost of renting the car
based on the rental rate per day and number of days the car is rented. If you rent the car for or more days, you get $ off your total cost. Alternatively, if you rent the car for or more days, you get $ off your total. You cannot get both of the above discounts at the same time.
averagelist Function to find the average of given list of numbers.
squareofnumbersnum numfunction to create and returns a list where the values are square of
numbers between and both included
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