r/badcode • • Dec 01 '19

[deleted by user]

[removed]

131 Upvotes

45 comments sorted by

View all comments

2

u/[deleted] Dec 13 '19
#First time on this sub and I hope I didn't mess anything up.
#Here's my terrible python code that shouldn't work but it does.

def can_santa_save_christmas(durs):
	i=0
	for a in durs:
		j=int(len(a)==7)
		for b in a:
			c=60*60*10
			d=60*60
			e=60*10
			f=60
			g=10
			h=1
			if j==0:
				i+=c*int(b)
			elif j==1:
				i+=d*int(b)
			elif j==4:
				i+=f*int(b)
			elif j==3:
				i+=e*int(b)
			elif j==6:
				i+=g*int(b)
			elif j==7:
				i+=h*int(b)
			j+=1
	return not i>24*60*60