[백준] 2016번 제곱ㄴㄴ수 - PYTHON import math min, max = map(int, input().split()) NN = [1] * (max - min + 1) tmp_01 = [] for i in range(2, int(math.sqrt(max)) + 1): tmp_01.append(i ** 2) for i in tmp_01: j = math.ceil(min / i) while i * j
import sys import math A_size = int(sys.stdin.readline()) A = sys.stdin.readline().replace("\n", "").split(' ') A = [int(i) for i in A] # A를 오름차순으로 정렬하여 작은 숫자부터 순서대로 정리된 새로운 list를 할당 sorted_A = [i for i in A] sorted_A.sort() P = [] # A의 각 숫자들에 대해 sorted_A에서의 index를 찾아 몇번째로 작은 숫자인지 P 수열에 새롭게 append함. for i in A: P.append(sorted_A.index(i)) # 이미 할당한 숫자는 sorted_A에서 -1로 대채해 재탐색되지 않도록 함. sorted_A[sor..
https://wikidocs.net/7040 241 ~ 250 .answer {margin-top: 10px;margin-bottom: 50px;padding-top: 10px;border-top: 3px solid LightGray;bo… wikidocs.net 248 os 모듈 os 모듈의 getcwd 함수를 호출하여 현재 디렉터리의 경로를 화면에 출력해보세요. 정답확인 import os ret = os.getcwd() print(ret, type(ret)) 249 rename 함수 바탕화면에 텍스트 파일을 하나 생성한 후 os 모듈의 rename 함수를 호출하여 해당 파일의 이름을 변경해보세요. 정답확인 import os os.rename("C:/Users/hyunh/Desktop/before.t..
파이썬 제어문 python control-flow """ Python Control-Flow if if - else for while break continue """ print("----- if, if - else") a = 33 b = 200 if b > a: print("b is greater than a") elif a == b: print("a and b equal") print("----- for") fruits = [ "apple", "banana", "cherry"] for x in fruits: print(x) print("----- while, break") i = 1 while i < 6: print(i) if( i == 3 ): break i += 1 print("----- cont..
google.colab 가져오기 파일에서 Jupyterlab에서 파일의 동일한 동작을 얻는 방법 현재 colab에서 잘 돌아가는 프로젝트를 진행하고 있는데 로컬 jupyterlab에서 수정하고 실행하고 싶지만 해당 프로젝트에는 colab과 같은 특정 기능이 있고 이런 방식으로 가져온 files기능 이 output있습니다 .from google.colab import filesfrom google.colab import output pypi에서 찾았으니 기본적 으로 모듈을 로컬에 설치한 pip install google-colab다음 노트북에서 사용할 수 있습니다. https://stackoverflow.com/questions/64103409/from-google-colab-import-files-how..
https://github.com/ngio/python_study/blob/main/true_false_quiz.py GitHub - ngio/python_study: python, konply, numpy, matplotlib, networkx, pandas python, konply, numpy, matplotlib, networkx, pandas - GitHub - ngio/python_study: python, konply, numpy, matplotlib, networkx, pandas github.com What will be the output? A.True B.False C.Error D.None of above """_summary_ What will be the output? A.Tru..