Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello! I am learning python and I recently got assigned a homework assignment. I wrote the code and got the results I wanted but the code is running twice.
Could you help me find the mistake please?
def main(): mt1=60 mt2=50 mt3=40 av1 = drop_minimum(mt1,mt2,mt3) av2 = change_weights(mt1,mt2,mt3) result = compare_results(av1,av2) print('Result for drop_minimum is',av1) print('Result for change_weights is',av2) print('Final grade is',result) def drop_minimum(grade1, grade2, grade3): if grade1<grade2 and grade1<grade3: av1=(grade2+grade3)/2 elif grade2<grade1 and grade2<grade3: av1=(grade1+grade3)/2 elif grade1==grade2 and grade2==grade3: av1=(grade1+grade2+grade3) else: av1=(grade1+grade2)/2 return av1 def change_weights(grade1, grade2, grade3): av2=(grade1*0.45)+(grade2*0.30)+(grade3*0.25) return av2 def compare_results(average1, average2): if average1>average2: best_avg= average1 else: best_avg= average2 return best_avg main()
When you say it's running twice, are you saying it's running twice on an Azure App Service @Ela E . I lifted you code and ran it locally and I only got a single set of results