본문 바로가기

PROGRAM/Python

(6)
랜덤뽑기 로또 출력하기 import random def printLotto(num_list): lotto = [] lotto = random.sample(num_list, 6) lotto.sort() for n in range(6): print(f'{lotto[n]:>02}', end=" ") #print(f'{str(lotto[n]).zfill(2)}', end=" ") print() numbers= list(range(1,46)) for i in range(5): printLotto(numbers) A-D가운데 하나 뽑고, 가~아 에서 2개 뽑아 출력하기 import random member1 = set(["A","B","C","D"]) member2 = set(["가","나","다","라","마","바","..
Class / lambda식 등 보호되어 있는 글입니다.
iris.csv 분석 In [65]: %matplotlib inline import seaborn as sns import pandas as pd import numpy as np import matplotlib.pyplot as plt In [17]: df = pd.read_csv("iris.csv") df.info() RangeIndex: 150 entries, 0 to 149 Data columns (total 5 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 sepal_length 150 non-null float64 1 sepal_width 150 non-null float64 2 petal_length 150 non-null fl..
jupyter notebook을 tistory에 적용하기 https://jfun.tistory.com/42 Jupyter Notebook에서 처리한 작업을 Tistory로 손쉽게 가져오기 주피터 노트북에서 작업한 내용을 깔끔하게 티스토리에 정리하는 노하우를 공개하겠다. (1) 주피터 노트북에서 File 탭에서 Print Preview를 누른다. (2) 새로운 창이 열리면서 주피터에서 작업한 내� jfun.tistory.com https://versusall.tistory.com/entry/1-Tistory-%EA%B8%80%EC%93%B0%EA%B8%B0-tip Jupyter Notebook 1. Tistory 글쓰기 tip Jupyter Notebook 1. Tistory 글쓰기 tip # Jupyter Notebook 1. Tistory 글쓰기 tip¶ 1..
class -sample class Man: def __init__(self, name): self.name = name print("초기화됨") def hello(self): print("Hello "+self.name+"!") def goodbye(self): print("Goodbye "+self.name+"!") m = Man("David") m.hello() m.goodbye() 초기화됨 Hello David! Goodbye David!
Turtle - Example import turtle t1 = turtle.Turtle() t2 = turtle.Turtle() t1.shape('turtle') t2.hideturtle() t2.pencolor('white') t2_move =[] while True: direction = input('방향입력(l:left, r:right, q:종료) : ') if direction == 'l': t1.left(90) t1.forward(100) t2_move.append('l') if direction == 'r': t1.right(90) t1.forward(100) t2_move.append('r') if direction == 'q': break if len(t2_move)==4 and t2_move[0]=='l': t2.l..