I am writing python code. I submitted an assignment but the professor said it was a modularization. Can you help me see what part of the code is modularization?
Pseudocode: 1. Decalre MainMethod () function:
# A. Parameters: Three numbers
# B. Put the three numbers in reverse
# 2. Main Program
# A. Initialize Varibles
# B. Accepts three values from the user
# C. Invoke MainMethod () function, passing the three numbers as
arguments in reverse
# D. Display the numbers in reverse
#------------------------------------------------------------------------
# Program Inputs:Three numbers in order
# Program Outputs:Reverse of the three numbers
#------------------------------------------------------------------------
print ("Main Method")
def MainMethod(lFirst, lSecond, lThird):
Average = 0.0
Average = (lFirst + lSecond + lThird) / 3
return Average
print ("Here is is in reverse: ", (Allnumbers[::-1]))
First = (input("First Number: "))
Second = (input("Second Number: "))
Third = (input("Third Number: "))
Allnumbers = First + Second + Third
print ("Here it is in reverse:",(Allnumbers[::-1]))
print("End of program")
CODE:-
def MainMethod(first,second,third): # the first step given in the step1 # is to declare the mainmethod with three parameters first,second,third = third,second,first # then to reverse them print("Reversed Numbers are:") # then to print them print(first,second,third) first = (input("First Number: ")) # in step 2 initialise variables second = (input("Second Number: ")) third = (input("Third Number: ")) MainMethod(first,second,third) # then invoking the mainmethod and printing the reverse
OUTPUT:-
FOR ANY OTHER QUERY PLEASE COMMENT.
I am writing python code. I submitted an assignment but the professor said it was a...
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...
I need help in Python. This is a two step problem So I have the code down, but I am missing some requirements that I am stuck on. Also, I need help verifying the problem is correct.:) 7. Random Number File Writer Write a program that writes a series of random numbers to a file. Each random number should be in the range of 1 through 500. The application should let the user specify how many random numbers the file...
I need a c++ code please. 32. Program. Write a program that creates an integer constant called SIZE and initialize to the size of the array you will be creating. Use this constant throughout your functions you will implement for the next parts and your main program. Also, in your main program create an integer array called numbers and initialize it with the following values (Please see demo program below): 68, 100, 43, 58, 76, 72, 46, 55, 92, 94,...
For Python debugExercise12.py is a recursive function that accepts an integer argument, n, and prints the numbers 1 up through n. By debugging these programs, you can gain expertise in program logic in general and the Python programming language in particular. def main(): # Local variable number = 0 # Get number as input from the user. number = int(input('How many numbers to display? ')) # Display the numbers. print_num(number) # The print_num function is a a recursive function #...
Please write the following code as simple as possible in python: You will need to define a function with four arguments. Here is what I used: > def find_matches(file1.txt, output1.txt, strings, value): file1.txt will contain a list of various strings. The program must copy from the first argument, and it should be written in the second argument (the second file, "output1.txt"). The third and fourth arguments will determine which specific strings will be copied over to the second file. For...
Write a Python program that asks the user to type in their three quiz scores (scores between 0 and 100) and displays two averages. The program should be written so one function gets the user to input a score, another function takes the three scores and returns the average of them. And another function takes the three scores and averages the two highest scores (in other words, drops the lowest). Each of these functions should do the computation and return...
Swapping Values in python Summary In this lab, you complete a Python program that swaps values stored in three variables and determines maximum and minimum values. The Python file provided for this lab contains the necessary input and output statements. You want to end up with the smallest value stored in the variable named first and the largest value stored in the variable named third. You need to write the statements that compare the values and swap them if appropriate....
Hi, I need some help finishing the last part of this Python 1 code. The last few functions are incomplete. Thank you. The instructions were: The program has three functions in it. I’ve written all of break_into_list_of_words()--DO NOT CHANGE THIS ONE. All it does is break the very long poem into a list of individual words. Some of what it's doing will not make much sense to you until we get to the strings chapter, and that's fine--that's part of...
This needs to be in python, however, I am having trouble with the code. Is there any way to use the code that I already have under the main method? If so, what would be the rest of the code to finish it? #Create main method def main(): #Create empty list list=[] #Display to screen print("Please enter a 3 x 4 array:") #Create loop for rows and have each entered number added to list for i in range(3): list.append([int(x) for...
convert this python code to c++ code def sort(a,b): if a > b: return b,a else: return a,b def main(): set1 = input('Enter the first pair of integers: ') set2 = input('Enter the second pair of integers: ') set3 = input('Enter the third pair of integers: ') set1 = set1.split(',') set1_0 = int(set1[0]) set1_1 = int(set1[1]) set2 = set2.split(',') set2_0 = int(set2[0]) set2_1 = int(set2[1]) set3 = set3.split(',') set3_0 = int(set3[0]) set3_1 = int(set3[1]) print(sort(set1_0,set1_1)) print(sort(set2_0,set2_1)) print(sort(set3_0,set3_1))