Study this at home on weekends and find a solution.
Crap less, on the code
1 #define a custom function, as follows2 #the name of the function must be a combination of letters and numbers and cannot begin with a number3 #after the function name, enclose the arguments in parentheses, and you can separate multiple4 #If there is a return value with return, if there is no return value, the default return is None5 6 defPanduanfenshu (score):7 if>= Score >= 90:8 Print("A")9 if> Score >= 80:Ten Print("B") One if> Score >= 60: A Print("C") - if> Score >=0: - Print("D") the ifScore < 0orScore > 100: - Print("Input Error") - - + defPANDUANFENSHU2 (score): - if>= Score >= 90: + return 'A' A ifScore >= 80: at return 'B' - ifScore >= 60: - return "C" - if> Score >=0: - return 'D' - ifScore < 0orScore > 100: in return 'Input Error'
Code at the time of invocation
1 #introducing a custom module2 ImportSYS3 4 #note the path string for the custom module has R before5Sys.path.append (R"D:\Users\Admin\Desktop\lianxi")6 7 #this sentence is necessary.8 ImportFenshu9 Ten #need to add file name and decimal point before calling OneFenshu. Panduanfenshu (9)
Importing custom modules under Windows Python Import