Question: Question : Prepare the flow diagram for this python code. # PYTHON PROGRAM import math #function to get grade def getGrade(x): if(x>90): return 'A' elif(x>80):
Question : Prepare the flow diagram for this python code.
# PYTHON PROGRAM
import math
#function to get grade def getGrade(x): if(x>90): return 'A'
elif(x>80): return 'B'
elif(x>70): return 'C'
elif(x>60): return 'D'
elif(x>50): return 'E'
else: return 'F'
# main function def main(): # ask user to enter credit hours and marks #list to store subject name subject = ["Mass Transfer","Heat Transfer","Surface Chemistry","Fuels","Petrochemical"]
# store marks and credit hours credit = [] marks = []
# ask user for i in range(0,5): a = int(input("Enter Credit hours and marks of "+subject[i]+" ")) b = int(input(""))
credit.append(a) marks.append(b)
# now print info temp = "i" temp1 = "Courses" temp2 = "Credit Hours,Wi" temp3 = "Marks" temp4 = "Grade,Gi"
# format all temp = "{0:
# print all for i in range(0,5): temp = "{0:
print(temp+temp1+temp2+temp3+temp4) # print GPA GPA = 0.0 s = 0.0 for i in range(0,5): GPA = GPA + float(credit[i]*marks[i]) s = s+credit[i]
print("GPA = "+str((GPA/s)));
# PROGRAM EXECUTION STARTS HERE main()
# SAMPLE OUTPUT
note : Only Prepare the flow diagram for this python code.
Enter Credit hours and marks of Mass Transfer 3 54 Enter Credit hours and marks of Heat Transfer 3 75 Enter Credit hours and marks of Surface Chemistry 2 82 Enter Credit hours and marks of Fuels 3 65 Enter Credit hours and marks of Petrochemical 2 85 i Courses Credit Hours, Wi Marks 1 Mass Transfer 3 54 2 Heat Transfer 3 3 Surface Chemistry 2 82 4 Fuels 3 65 5 Petrochemical 2 85 GPA = 70.46153846153847 Grade, Gi E C 75 B D BStep by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
