일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- 차이
- docker-compose
- GCP mysql
- Glue의 두 가지 핵심 기능
- 공백트림
- python
- 프로그래머스
- 공백Trim
- 맞출수있었는데...
- docker
- s3목록
- 파이서닉
- 답안지표기잘못한느낌...
- 데이터카탈로그
- Codility
- 이직 3개월차
- 1000개 이상
- import from 차이점
- airflow설치
- AWS
- docker airflow
- 코테
- 도커 에어플로
- 공백null치환
- Glue
- 디비설치
- Binary_gap
- cyclerotation
- 파이써닉
- 코딩테스트
- Today
- Total
목록python (12)
작은하마
파이썬으로 개발을 하다보면 import pandas as pd from pyspark import sparkcontext 와같은 패키지 또는 함수호출 명령어를 사용한다. import는 무엇이고 from은 무엇일까? import 모듈이름 - 해당하는 모듈 전체를 가져온다. - 사용을 하려면 모듈이름.메소드 형식으로 사용한다. from 모듈이름 import 메소드or변수 - 해당하는 모듈의 특정 메소드, 변수만을 가져온다. - 사용을 하려면 메소드명만을 사용한다. - from 모듈이름 import * => import 모듈이름 과 같다. import 모듈이름 as 별칭 - 모듈이름이 길어 사용성이 안좋을경우 별칭을 사용하여 사용한다. - 별칭.메소드 형식으로 사용한다.
https://app.codility.com/programmers/lessons/4-counting_elements/perm_check/ PermCheck coding task - Learn to Code - Codility Check whether array A is a permutation. app.codility.com def solution(A): A=sorted(A) if A[0]!=1: return 0 else: for i in range(len(A)-1): if A[i]+1!=A[i+1]: return 0 else : continue return 1
https://app.codility.com/programmers/lessons/3-time_complexity/frog_jmp/ FrogJmp coding task - Learn to Code - Codility Count minimal number of jumps from position X to Y. app.codility.com 처음에 while문으로 했지만 시간복잡도가 0점이 나왔다.. count=0 while True: x+=d count+=1 if x>=y: break count 그래서 아래것으로 바꾸어 풀어보았다. # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") import ma..
https://app.codility.com/programmers/lessons/2-arrays/odd_occurrences_in_array/start/ Codility Your browser is not supported You should use a supported browser. Read more app.codility.com 배열 A가 주어졌을때 짝이 맞지 않는 수를 반환하는 문제이다. 배열에서 하나의 숫자 빼고는 다 짝이 맞도록 설정이되어있다. st=list(set(a)) for i in st: cnt=a.count(i) if cnt==1: answer=i answer 처음에 이런식으로 접근을 하였는데 55점이 나왔다. 이유는 O(n**2) 시간복잡도가 만족하지 않은것...
1~50000사이의 임의의 숫자 N이 주어진다. N이 주어지면 이 숫자보다 큰 숫자중에 각 자리수 합이 일치하는 숫자를 찾는 문제 Ex) 123이 주어졌을때 각 자리 숫자의 합은 1+2+3=6이다 123보다 크면서 각 자리 숫자가 6이되는 첫 숫자는 132이다. 나는 이걸 map을 써서 풀었다. 숫자는 리스트로 저장할 때 각 자리 숫자로 저장이 안되기 떄문이다. 참고로 map함수는 '리스트'의요소를 지정된 함수로 저장해주는 함수이다. n=123 comp=sum(list(map(int,str(n)))) while n
https://app.codility.com/programmers/lessons/2-arrays/cyclic_rotation/ CyclicRotation coding task - Learn to Code - Codility Rotate an array to the right by a given number of steps. app.codility.com # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A, K): answer=[] if len(A)==0: answer=A elif K==0 or K%len(A)==0 or len(A)==K : answer=A else: K..
https://app.codility.com/programmers/trainings/1/longest_password/ LongestPassword coding task - Practice Coding - Codility Given a string containing words, find the longest word that satisfies specific conditions. app.codility.com 이문제는 isalnum()의 사용과 문자, 숫자 추출을 가능케하는 re.findall을 이용하면 쉽게 풀 수 있었다. 문론 나보다 잘 푸는 사람도 많다. import re s='te$##st 5 a0A pass007 ?xy1' s=s.split(' ') max=-1 for i in s: if i...
https://app.codility.com/demo/results/trainingJCD5A7-MFN/ Test results - Codility A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The app.codility.com A binary gap within a positive integer N i..
https://programmers.co.kr/learn/courses/30/lessons/42626 코딩테스트 연습 - 더 맵게 매운 것을 좋아하는 Leo는 모든 음식의 스코빌 지수를 K 이상으로 만들고 싶습니다. 모든 음식의 스코빌 지수를 K 이상으로 만들기 위해 Leo는 스코빌 지수가 가장 낮은 두 개의 음식을 아래와 같 programmers.co.kr 코드를 짰는데 효율성에서 시간초과가 떠서 고민이다 def solution(scoville, K): answer = 0 for i in range(len(scoville)): if min(scoville)K: break return answer 더 효율적으로 짤수 있는 방법이 없을까??? 아시는분 댓글좀...남겨주세요
https://programmers.co.kr/learn/courses/30/lessons/17681 코딩테스트 연습 - [1차] 비밀지도 비밀지도 네오는 평소 프로도가 비상금을 숨겨놓는 장소를 알려줄 비밀지도를 손에 넣었다. 그런데 이 비밀지도는 숫자로 암호화되어 있어 위치를 확인하기 위해서는 암호를 해독해야 한다. 다 programmers.co.kr 위의 문제를 읽었을때 딱 논리 게이트를 생각하지 못한다면 아마 문제를 풀기가 어려울 것이다 먼저, 2진수를 비교하는 방법을 생각한다. 파이썬에는 고맙게도 bin(n)과 format(n,'b')의 기능이 있다. 둘중에 무엇을 쓸까 하다가 bin(n)을 쓰게되면 이진수 앞에 0b가 붙어버려서 제거를 해줘야 하기때문에 format(n,'b')를 쓰기로했다. 그..