Best Python code snippet using localstack_python
2022 KAKAO BLIND 주차 요금 계산.py
Source: 2022 KAKAO BLIND 주차 요금 계산.py
1def check_fee(fees,out_time,in_time) :2 otime=03 itime=04 user_fee=05 6 o_hour=out_time[0:2]7 o_min= out_time[3:5]8 9 otime=int(o_hour)*60+int(o_min)10 11 i_hour=in_time[0:2]12 i_min= in_time[3:5]13 14 itime=int(i_hour)*60+int(i_min)15 16 user_time = otime-itime17 18 if user_time<=fees[0]:19 return fees[1]20 else:21 user_fee+=fees[1]22 user_time-=fees[0]23 24 if user_time%fees[2]==0:25 user_fee+= (user_time//fees[2]) * fees[3]26 else:27 user_fee+= (user_time//fees[2]+1) * fees[3]28 29 return user_fee30def user_fee2(fees,user_time) :31 user_fee=032 if user_time<=fees[0]:33 return fees[1]34 else:35 user_fee+=fees[1]36 user_time-=fees[0]37 38 if user_time%fees[2]==0:39 user_fee+= (user_time//fees[2]) * fees[3]40 else:41 user_fee+= (user_time//fees[2]+1) * fees[3]42 43 return user_fee44def user_time(out_time,in_time) :45 otime=046 itime=047 48 o_hour=out_time[0:2]49 o_min= out_time[3:5]50 51 otime=int(o_hour)*60+int(o_min)52 53 i_hour=in_time[0:2]54 i_min= in_time[3:5]55 56 itime=int(i_hour)*60+int(i_min)57 58 user_time = otime-itime59 60 return user_time 61def solution(fees, records):62 answer = []63 record_arr=[]64 check_stack=[]65 dic_fee={}66 67 for i in range(0,len(records)):68 time,num,act= map(str,records[i].split())69 record_arr.append([num,time,act])70 71 record_arr.sort()72 for j in range(0,len(record_arr)):73 #check_stack ê° ììê²½ì°74 if check_stack :75 76 #INì¼ê²½ì°77 if record_arr[j][2] =='IN':78 #INì¼ ê²½ì° check_stack ë§ì§ë§ ê° ë¹êµí´ì ë¤ë¥´ë©´ check_stack pop íê³ 23:59 ì¶ì°¨ì²ë¦¬ ì§í í ê° append79 if record_arr[j][0] != check_stack[-1]:80 record_arr.append([check_stack[-1],'23:59','OUT'])81 check_stack.pop()82 check_stack.append(record_arr[j][0])83 elif record_arr[j][2] =='OUT':84 check_stack.pop() 85 86 #check_stack ë¹ì´ììê²½ì°87 else:88 #INì´ëê¹ ë°ë¡ ë¤ì´ì¨ë¤.89 check_stack.append(record_arr[j][0])90 if check_stack:91 record_arr.append([check_stack[-1],'23:59','OUT'])92 93 record_arr.sort() 94 for k in range(0,len(record_arr),2):95 96 if record_arr[k][0] in dic_fee:97 dic_fee[record_arr[k][0]]+=user_time(record_arr[k+1][1],record_arr[k][1])98 else:99 dic_fee[record_arr[k][0]]=user_time(record_arr[k+1][1],record_arr[k][1])100 101 102 print(dic_fee)103 for i in dic_fee:104 print(user_fee2(fees,dic_fee[i]))105 answer.append(user_fee2(fees,dic_fee[i]))106 ...
D.py
Source: D.py
1def calc_ranges(base, complexity):2 r = [0]3 pr = 14 for x in xrange(complexity):5 pr *= base6 r.append(pr)7 return r89# def get_position(ranges, check_stack):10# pos = 011# for i in check_stack:12# pos += ranges[i-1]*(i-1)13# return pos1415def get_position(ranges,count, check_stack):16 if count == 1:17 #print "Last: %d"%check_stack[0]18 return check_stack[0]19 shift = ranges[count-1]*(check_stack[count-1]-1)20 deeper_val = get_position(ranges,count-1,check_stack)21 #print (ranges,check_stack, count)22 #print "shift %d\tval %d"%(shift,deeper_val)23 return shift+deeper_val242526def check_next(base, complexity, last_checked):27 to_check = last_checked+128 check_stack = []29 for x in xrange(0,complexity):30 check_stack.append(to_check)31 to_check+=132 if to_check>base:33 break34 return check_stack, to_check-13536out_strings = []37T = input()38for itttt in xrange(T):39 base, complexity, students = [int(x) for x in raw_input().split()]40 last_checked = 041 ranges = calc_ranges(base, complexity)42 s = 043 positions = []44 while s<students and last_checked<base:45 check_stack, last_checked = check_next(base, complexity,last_checked)46 #p = get_position(ranges, check_stack)47 p = get_position(ranges,len(check_stack),check_stack)48 s+=149 positions.append(p)50 out = "IMPOSSIBLE" if last_checked!=base else " ".join([str(x) for x in positions])51 out_strings.append("Case #%d: %s"%(itttt+1,out))52print "\n".join(out_strings)5354def out_file():55 f = open('output.txt','w')56 f.write('\n'.join(out_strings))57 f.close()58
...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!