Python if statement not working correctly

后端 未结 4 1863
有刺的猬
有刺的猬 2021-01-28 01:29

Im a very new Python user (2.7) and have been working my way through the Learn Python The Hard Way course and up to chap 37 and decided to do read through some other learning ma

4条回答
  •  抹茶落季
    2021-01-28 02:11

    I am refering to the same material by Dr. Andrew Harrington and I am doing the same program, my program may look pretty much amatuerish so I would highly appreciate if someone can kindly refine it

    def graduateEligibility(credits):
        if credits >= 120:
            print("Congratulations on successfully completing the course.....see you on graduation day!")
        else:
            print("Sorry! Your credits are below 120, please kindly retake the evaluaton tests")
    
    
    def main():
        E = float(input("Enter your English marks:"))
        M = float(input("Enter your Mathematics marks:"))
        P = float(input("Enter your Physics marks:"))
        C = float(input("Enter your Chem marks:"))
        Cf = float(input("Enter your Comp.Fundamentals marks:"))
        Fin_Edu = float(input("Enter your finance marks:"))
        Const = float(input("Enter your Constitutional.Stds marks:"))
        R = float(input("Enter your Reasoning marks:"))
        TotalCredits = (E+M+P+C+Cf+Fin_Edu+Const+R)
        YourCredits = graduateEligibility(TotalCredits)
    main()
    

    For simplicity sakes i have taken 8 subjects each have 20 credits.

提交回复
热议问题