Hi I need help of writing a complete Pseudocode in Python 3 for this topic only
ID: 3739495 • Letter: H
Question
Hi I need help of writing a complete Pseudocode in Python 3 for this topic only algorithms and a Pseudocode can someone please help me out thank you. Also, I have desired to use for loops and please make it clear so I can read it and provide some explanation but I need it to make it simple thank you.
Prompting the user to input a set of grades and print the highest value, minimum value, and average.
Explain why you chose the type of control structures and/or loops used in your algorithm (if-else, for, while, etc.). Explain how you might revise the algorithm you designed in Module Two based on any new information you learned here.
Explanation / Answer
First, any Pseudocode is independent of programing language. Whatever your Pseudocode is it is valid for any programing language of that particular domain.
Algorithm:
step 1: start
step 2: Declare variable average, maximum = 0, minimum = 9999 , sum = 0
step 3: Declare grades [] # In python3 use list -> because its mutable
step 3: for j <- 1 to length(grades) # use for loop
step 4: if maximum < grades[j]
step 5: maximum = grades[j]
step 6: if minimum > grades[j]
step 7: minimu = grades[j]
step 8: sum = sum + grades[j]
step 9: average = sum /length(grades)
step 10: output avg , minimium, maximum
step 11: stope
Explanation:
In python3 use
1). use list because its mutable and grade may not be unique.
2). Use for loop as you mention but be careful about the index. Because index in programming is start with 0
3). I use if statement but you may also use inbuild function max() and min()
4). if you want data in a int than use //
code:
Is an example:
FOR ANY OTHER QUERY ASK IN COMMENT !!!