Question

Design a function named max that accepts two integer values as arguments and returns the value...

Design a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. For example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two.

Need Variable lists, Psuedocode, ipo chart, Flow Chart, and a python code.

Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Design the following functions in the program:

calcAverage—This function should accept five test scores as arguments and return the average of the scores.

determineGrade—This function should accept a test score as an argument and return a letter grade for the score (as a String), based on the following grading scale:

Score Letter Grade
90–100 A
80–89 B
70–79 C
60–69 D
Below 60

F

Need Variable lists, Psuedocode, ipo chart, Flow Chart, and a python code.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

MAximum of two numbers :

def max( firstNumber , secondNumber ): //function max crated with two argument
if firstNumber > secondNumber:
return firstNumber
else:
return secondNumber

def getNumbersFromUser(): //getNumbersFromUser created for taking input from user
userFirstNumber = int( input( "Please enter 1 numbr" ) )
userSecondNumber = int( input( "Please enter 2 numbr" ) )
return userFirstNumber, userSecondNumber
  
def main():
userFirstNumber, userSecondNumber = getNumbersFromUser()
print( " Maximum : ", max(userFirstNumber, userSecondNumber ) )

main()
  

2. average

def calcAverage( s1, s2, s3, s4, s5 ):

average = ( s1 + s2 + s3 + s4 + s5 ) / 5

return average

def determingrade( userscore ):

if( userscore < 60 ):

return "F"

elif( userscore < 70 ):

return "D"

elif( userscore < 80 ):

return "C"

elif( userscore < 90 ):

return "B"

elif( userscore < 101 ):

return "A"

def askscore():

s1 = float( input( "Enter s1 " ) )

s2 = float( input( "Enter s2 " ) )

s3 = float( input( "Enter s3 " ) )

s4 = float( input( "Enter s4 " ) )

s5 = float( input( "Enter s5 " ) )

return s1, s2, s3, s4, s5

def printresult( s1, s2, s3, s4, s5 ):

print( " score \t\t Grade" )

print( str( s1 ) + "\t\t\n" + determingrade( s1 ), str( s2 ) + "\t\t\n" + determingrade( s2 ), str( s3 ) + "\t\t\n" + determingrade( s3 ),str( s4 ) + "\t\t\n" + determingrade( s4 ),str( s5 ) + "\t\t\n" + determingrade( s5 ) )

def main():

s1, s2, s3, s4, s5 = askscore()

printresult( s1, s2, s3, s4, s5 )

main()


Start PLEASE INPUT Ist Nombes GET X lPLEASE İNPUT and Nambes GET Y PUT Both ase e PUT Bigest Numbes is: tox END

Pseudocode :-

1)start the program

2) get the both the inputs X and Y

3)Check whether both are same or not

4)

  • if both are same then , in one of the node and printing that "both are equal"
  • if different , then in the another node ; check for whether X>Y
    • if true , then print biggest number is X
    • if false ,( X is not greater than Y ) ,then print biggest number is Y
  • merge all the nodes at a point and then end the program
Add a comment
Know the answer?
Add Answer to:
Design a function named max that accepts two integer values as arguments and returns the value...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that asks the user to enter five test scores. The program should display...

    Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Design the following functions in the program: calcAverage—This function should accept five test scores as arguments and return the average of the scores. determineGrade—This function should accept a test score as an argument and return a letter grade for the score (as a String), based on the following grading scale: Score Letter Grade...

  • I am supposed to a pseudocode function named max that accepts two integer values as arguments...

    I am supposed to a pseudocode function named max that accepts two integer values as arguments and returns the value that is greater of the two. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is greater of the two. Is everything correct and complete? //Pseudocode //This function takes two integers as parameters: x and y Begin : Max(x,y) If(x>y) then MAX=x Else MAX=y End if Return...

  • Solve This Problem using python and please comment on every line. also, use function to solve...

    Solve This Problem using python and please comment on every line. also, use function to solve this. thanks The result will be like as below: Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following functions in the program: This function should accept five test scores as arguments and return the average of the scores. This function should accept a...

  • PYTHON QUESTION PLEASE!! Write a function named problem3 that accepts two strings as the arguments, returns...

    PYTHON QUESTION PLEASE!! Write a function named problem3 that accepts two strings as the arguments, returns the characters that occur in both strings. Test case: the arguments are “apple@123” and “banana@#345”, your program should return “a@3”. Write a function named problem3 that accepts two strings as the arguments, returns the characters that occur in both strings. (20 pts) Test case: the arguments are "apple@123” and “banana@#345”, your program should return "a@3".

  • Python problem QUESTION 48 Write a function named was that accepts two integer values as arquments...

    Python problem QUESTION 48 Write a function named was that accepts two integer values as arquments and returns the wake that is greater of the two for example, if 7 and 12 are passed as arguments the function should return 12. If the arguments are equal the function should return zero. TTTA 3112) T V 2

  • PYTHON: Using Lists and Arrays! 5. In a program, write a function that accepts two arguments:...

    PYTHON: Using Lists and Arrays! 5. In a program, write a function that accepts two arguments: a list, and a number n. The program should generate 20 random numbers, in the range of 1 through 100, and assign each number to the list. The program should also ask the user to pick a number from 1 through a 100 and assign that number to n. The function should display all of the number in the list that are greater than...

  • Total Sales Design a program that asks the user to enter a store’s sales for each...

    Total Sales Design a program that asks the user to enter a store’s sales for each day of the week. The amounts should be stored in an array. Use a loop to calculate the total sales for the week and display the result. Need: variable lists, IPO Chart, pseudocode, Flowchart, and working Python code. 2. Lottery Number Generator Design a program that generates a 7-digit lottery number. The program should have an Integer array with 7 elements. Write a loop...

  • I need help with this c++ question please thank you ltls. The program should urt valte....

    I need help with this c++ question please thank you ltls. The program should urt valte. 11. Lowest Score Drop Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions: void getscore() should ask the user for a test score, store it in a reference param- eter variable, and validate it. This function should be called by main once for each of...

  • Using basic c++ write 2 separate codes for this assignment. Program #1 Write a program that...

    Using basic c++ write 2 separate codes for this assignment. Program #1 Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions. • void getScore() should ask the user for a test score, store it in the reference parameter variable, and validate it. This function should be called by the main once for each of the five scores to be entered. •...

  • Write templates for the two functions minimum and maximum. The minimum function should accept two arguments...

    Write templates for the two functions minimum and maximum. The minimum function should accept two arguments and return the value of the argument that is the lesser of the two. The maximum function should accept two arguments and return the value of the argument that is the greater of the two. Test your functions in a main program that propmts the user to choose what type of data they would like to compare (ints, doubles, or strings). Then, it should...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT