top of page

Forum Comments

1/12/22 - FSAs and Regular Expressions
In ACSL Contest Prep
tylerdee7
Jan 13, 2022
0
0
Python 1 - ACSL Timesheets
In AP Computer Science A
tylerdee7
Sep 26, 2018
total = 0 #total income line = input("") #3, 9, H line2 = input("") #17, 1, E line3 = input("") #20, 5, G line4 = input("") #15, 2, 8 for i in range(4): if (i == 0): #in each new loop, line1 is replaced by other inputs line1 = line elif (i==1): line1 = line2 elif (i==2): line1 = line3 elif (i==3): line1 = line4 location,b,c = line1.split(",") #takes away the comments location = float(location) #location can now be used for math check = c[1]; #default of check variable if (c[1]=="1"): #replacing 1 with actual time (9:00) check=9 elif (c[1]=="2"): check=9.5 elif (c[1]=="3"): check = 10 elif (c[1]=="4"): check = 10.5 elif (c[1]=="5"): check = 11 elif (c[1]=="6"): check = 11.5 elif (c[1]=="7"): check = 12 elif (c[1]=="8"): check = 12.5 elif (c[1]=="9"): check = 13 elif (c[1]=="A"): check=13.5 elif (c[1]=="B"): check = 14 elif (c[1]=="C"): check = 14.5 elif (c[1]=="D"): check = 15 elif (c[1]=="E"): check = 15.5 elif (c[1]=="F"): check = 16 elif (c[1]=="G"): check = 16.5 elif (c[1]=="H"): check = 17 if (b==" 1"): #I added a space because b will always be: " x" b=9 elif (b==" 2"):#Same with a: " x" (but I made variable "a" a float, so b=9.5 elif (b==" 3"):#there shouldn't be extra spaces b=10 elif (b==" 4"): b=10.5 elif (b==" 5"): b=11 elif (b==" 6"): b=11.5 elif (b==" 7"): b=12 elif (b==" 8"): b=12.5 elif (b==" 9"): b=13 check = float(check)#for math b = float(b)#for math if (location<10):#different locations mean different incomes print ("$", end=str(10*(check-b)))#in order to add that 0 print ("0")#so I can print in the cents form total = total+10*(check-b) elif (location>10 and location<20): if ((check-b)>4): print ("$", end=str(32+12*((check-b)-4))) print ("0") total = total + 32+12*((check-b)-4) else: print ("$", end=str(8*(check-b))) print ("0") total = total+8*(check-b) elif (location>19 and location<30): if ((check-b)>4): print ("$", end=str(48+24*((check-b)-4))) print ("0") total = total + 48+24*((check-b)-4) else: print ("Ur doo doo, I don't know what location that is.") print ("$", end = str(total))#finally print the total amount print ("0") #Mrs. Mae- I could also use the replace("","") function instead of split(), which I can tell makes a whole lot more sense
1
0

tylerdee7

Forum Moderator
More actions
bottom of page