The programs for this week will all take the
form:
def main():
collect the input for the
arguments
value = functionName(arguments)
print(value)
def functionName(arguments):
code to solve the
problem
return value
main()
Write programs using functions to solve:
• Write the following functions and provide a program to test
them. Include descriptive statements that prompt the user for the
the three input variables.
b. def average(x, y, z) (returning th average of the arguments)
def main():
x = int(input("Enter first input: "))
y = int(input("Enter first input: "))
z = int(input("Enter first input: "))
value = average(x,y,z)
print(value)
def average(x,y,z):
return (x+y+z)/3
main()



The programs for this week will all take the form: def main(): collect the...
MUST BE WRITTEN IN C++
All user input values will be entered by the user from prompts in the main program. YOU MAY NOT USE GLOBAL VARIABLES in place of sending and returning data to and from the functions. Create a main program to call these 3 functions (5) first function will be a void function it will called from main and will display your name and the assignment, declare constants and use them inside the function; no variables will...
THIS CODE IS IN PYTHON #This program calls a function from the main function def getInput(): ''' This function gets the rate and the hours to calculate the pay ''' userIn = float(input("Enter the rate: ")) print(userIn) inputHours = float(input("Enter the hours: ")) print(inputHours) def main(): getInput() main() YOU NEED TWO FUNCTIONS : main() function get_inputs function
Need help writing this code in python.
This what I have so far.
def display_menu():
print("======================================================================")
print(" Baseball Team Manager")
print("MENU OPTIONS")
print("1 - Calculate batting average")
print("2 - Exit program")
print("=====================================================================")
def convert_bat():
option = int(input("Menu option: "))
while option!=2:
if option ==1:
print("Calculate batting average...")
num_at_bats = int(input("Enter official number of at bats:
"))
num_hits = int(input("Enter number of hits: "))
average = num_hits/num_at_bats
print("batting average: ", average)
elif option !=1 and option !=2:
print("Not a valid...
code in C++ Create a program that uses the pass by reference operator instead of the return command. Your main program will need to: create empty variables call void function 1 with no input to display your name to the screen call function 2 to collect the square feet that a gallon of paint covers from user call function 2 to collect the square feet of wall that needs to be painted call function 3 to calculate the number of...
C++
This week, you are to create two separate programs, first using a simple array and the second using a 2D-array (matrix). [Part 1] Write a program that accepts exactly ten (10) integer numbers from the user and stores them in an array. In a separate for-loop, the program then goes through the elements in the array to print back: (i) The sum of the 10 numbers, (ii) the minimum value from the 10 numbers, and (iii) the maximum value...
# Find the error in the following program. def main(): # Get a value from the user. value = input("Enter a value.") # Get 10 percent of the value. ten_percent(value) # Display 10 percent of the value. print("10 percent of ", value, " is ", result) # The ten_percent function returns 10 percent # of the argument passed to the function. def ten_percent(num): return num * 0.1 main()
Question 4-6 Please.
Python 3.6. def main().
entered by a user. Write a program that finds the sum and average of a series of numbers he program should first prompt the user to enter total numbers of numbers are to be summed and averaged. It should then as for input for each of the numbers, add them, and print the total of the numbers and their average 2. Write a progra m that finds the area of a circle. The...
You are to write a program IN C++ that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: if the an item's wholesale cost is 5.00 and its markup percentage is 100%, then the item's retail price is 10.00 If an item's wholesale cost is 5.00 and its markup percentage is 50%, then the item's retail price is 7.50 Program design specs. You should have 5...
Program: Write a complete C++ program that is made of functions main() and rShift(). The rShift() function must be a function without return with 6 parameters. rShift() should do following. Shift the first 4 formal parameters' value one place to right circularly and send the updated values out to the caller function, i.e. main. Furthermore, after calling this function with the first 4 actual parameters, say a1, a2, a3, a4, and these actual parameters should shift their value one place...
Write a MIPS code which involves three functions: a. main b. poly c. pow to compute the value of the polynomial given below for any value of x, as given by the user. f(x) = 3x^5 + 2x^4 - 5x^3 - x^2 + 7x - 6 Your program must pass arguments to functions such as poly and pow and get return values from these functions. The input to the program (which is x) is...