Accoring to the code provided in the function addFive
it has one parameter, "value"
we are returning two pront statements . one with beore entering value and other is leaving values.
as per code first print statement will print a value which the parameter has passed.
after this there is a other statement in which there is addition of value 5 to the paramter
and the second print statement will print a addition values here.
So the output goes like this.
value is initilized as 10 and addFive function has been called.
sofirst print resturn a value and next one restunr a value 15
In Python Read section 6.4 at least through part 6.4. 1. Then examine this function def...
Python Programming assignment : Function of Q3: def isPositive(n): if(n>=0): return True else: return False Write a code for function main, that does the following: -creates a variable and assigns it the value True. - uses a while loop which runs as long as the variable of the previous step is True, to get a number from the user and if passing that number to the function of Q3 results in a True value returned, then add that number to...
Python Programming assignment : Function of Q3: def isPositive(n): if(n>=0): return True else: return False Write a code for function main, that does the following: -creates a variable and assigns it the value True. - uses a while loop which runs as long as the variable of the previous step is True, to get a number from the user and if passing that number to the function of Q3 results in a True value returned, then add that number to...
Part 1: Read 2 numbers from the user. One small number and one big number for the range. Use this in a for loop with range (for x in range(small, big)) Add all the numbers in this range and store in a variable called total. Print total. Part 2: Make a list of colors called COLORS. Have at least 10 colors. Read one color from the user in a variable called color. Now use a for loop, and see if...
PYTHON:please display code in python
Part 1: Determining the Values for a Sine
Function
Write a Python program that displays and describes the equation
for plotting the sine function, then prompts the user for the
values A, B, C and D to be used in the calculation. Your program
should then compute and display the values for Amplitude, Range,
Frequency, Phase and Offset.
Example input/output for part 1:
Part 2: Displaying a Vertical Plot Header
A vertical plot of the...
PYTHON QUESTION Given the following function: def sort(A, n): for i in range (1, n): for j in range(i-1, -1,-1): if A[j + 1] > A[j]: t = A[j+1] A[j+1] = A[j A[j] = t What would the output be for the following array: A = [3, 10, 2, 8,15]; where n = 5; for each iteration of i (i.e. when i = 1, i=2, i=3, i=4)? A. 10, 3, 2, 8, 15 B....
Part 1 Encapsulate the following Python code from Section 7.5 in a function named my_sqrt that takes a as a parameter, chooses a starting value for x, and returns an estimate of the square root of a. while True: y = (x + a/x) / 2.0 if y == x: break x = y Part 2 Write a function named test_sqrt that prints a table like the following using a while loop, where "diff" is the absolute value of the...
(IN PYTHON) You are to develop a Python program that will read the file Grades-1.txt that you have been provided on Canvas. That file has a name and 3 grades on each line. You are to ask the user for the name of the file and how many grades there are per line. In this case, it is 3 but your program should work if the files was changed to have more or fewer grades per line. The name and...
Consider the following Python program: def fun(x, y): return x + y # [2] # [1] a = fun(2, 3) b = fun("2", 3) print a, b What does it evaluate to? Replace the last statement print a, b with print a + b and explain the traceback. What's wrong? Now eliminate the line marked [1] and change line [2] to read return x + y. Run the program and explain the traceback. Consider the following definition: def fun(n, m):...
USING PYTHON PROGRAMMING LANGUAGE
CELSIUS FUNCTION:
def convertF(fTemp):
c = (fTemp - 32) * (5 / 9)
print(fTemp, "Fahrenheit is equal to %.0f" % c, "Celsius.")
fTemp = float(input("Enter Fahrenheit temp to convert: "))
convertF(fTemp)
2.3. Do you think Python will print anything different if you pass a floating point number to celsius? What would Python print for this expression? Explain >>>celsius(60.0) 24. Do you think the celsius function can deal with negative numbers? What will Python do with this...
in python 3 1. A program contains the following function definition: def cube(num): return num * num * num Write a statement that passes the value 4 to this function and assign its return value to the variable result. 2. Write a function named get_first_name that asks the user to enter his or her first name and returns it.