|
|
вернуться в форум1409 Runtime Error Dear All, I am a student and I got an assignment from my teacher to run "1409 Two Gangsters". I write Python program v.2.7 as per following codes. I run the program many times, but it still showed "Runtime Error". I could not fix it. It would be appreciated if someone can help me. Thanks. # 1409 Two Gangsters (Created: 24th June 2015 / Python 2.7) # -------------------- Start of Program -------------------- # # Set initial values total = 0 # total number of cans shot by Harry and Larry Harry = 0 # the number of cans shot by Harry Larry = 0 # the number of cans shot by Larry h = 0 # the number of cans that were not shot by Harry l = 0 # the number of cans that were not shot by Larry Harry = int(input("Please enter the number of cans shot by Harry: ") Larry = int(input("Please enter the number of cans shot by Larry: ")
# Calculation of "The number of cans that were not shot by Harry and Larry" total = Harry + Larry -1 h = total - Harry l = total - Larry # Output print "-"*100 print "Total number of cans are : ", total print "The number of cans that were not shot by Harry and Larry are ", h, "and", l, "respectively." print "-"*100 # -------------------- End of Program -------------------- # |
|
|