Question: Q 6 : Explain what a local variable is and why it cannot be accessed outside its function. Q 7 : Create a global constant
Q: Explain what a local variable is and why it cannot be accessed outside its function.
Q: Create a global constant named DISCOUNTRATE with a value of Write two functions, calculatediscountprice and calculatefinalpriceprice The calculatediscount function should use DISCOUNTRATE to calculate the discount amount, while calculatefinalprice should return the price after applying the discount. Test these functions with different values for price.
Q: Write a function named square that takes a single parameter, num, and returns the square of that number. Then write a line of code to store and print the square of
Q: Define a function named calculateaverage that takes three test scores as parameters and returns their average. Use this function to calculate the average of three different sets of test scores.
Custom ValueReturning Functions in Complex Expressions
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
