https://www.python.org/downloads/
:최신버전으로 다운받아 설치 진행하기
Jupyter Notebook 사용 방법
1. cmd 창에서 pip3 install jupyter 실행
2. cmd 창 다시 열고 jupyter notebook
3. 웹페이지가 열리면 우측에서 new - Python3 선택
4. 상단 untitled 클릭하고 파일명 변경
5. 한줄 한줄 실행후 run(ctrl+enter)
단축키
shift+enter : 실행후 아래셀로 이동
ctrl+enter : 실행
alt+enter : 실행후 아래에 새로운 셀 추가
esc 로 코드창에서 빠져나온후
a : 위로 셀 추가
b : 아래로 셀 추가
d(2번) : 현재셀 삭제
l : 라인번호 on/off
enter : 명령모드에서 수정모드로 변경
import time as ti
curYear=ti.localtime().tm_year;
myName=input("이름을 입력하세요:")
myYear=input("태어난 년도를 입력하세요:")
myAge=curYear-int(myYear)+1
print("이름:",myName)
print("나이:",myAge)
#r,g,b 색상과 반지름을 입력하면 해당 색상으로 채워진 원을 그리시오
import turtle as t
ws=t.Screen()
ws.colormode(255)
r=int(input("색상의 R값 입력:"))
g=int(input("색상의 G값 입력:"))
b=int(input("색상의 B값 입력:"))
rad=int(input("반지름 입력:"))
t.color((r,g,b))
t.begin_fill()
t.circle(rad)
t.end_fill()
t.exitonclick()
import turtle
import random
screen = turtle.Screen()
screen.bgcolor('black') # 배경을 검은색으로 설정
stars = turtle.Turtle()
stars.speed(0) # 가장 빠른 속도
stars.hideturtle() # 터틀 아이콘 숨기기
colors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple', 'white']
def draw_star(turtle, color, size, x, y):
turtle.penup()
turtle.color(color)
turtle.goto(x, y)
turtle.pendown()
turtle.begin_fill()
for i in range(5):
turtle.forward(size)
turtle.right(144)
turtle.end_fill()
for _ in range(100):
color = random.choice(colors)
size = random.randint(5, 25)
x = random.randint(-300, 300)
y = random.randint(-300, 300)
draw_star(stars, color, size, x, y)
turtle.done()
'학교 & 학원 이론 수업 > 네이버 클라우드 AIaaS 개발자 양성 과정' 카테고리의 다른 글
aws ec2 접속하기 (2) | 2023.05.24 |
---|---|
230524 - 파이썬 (2) (0) | 2023.05.24 |
230512 Docker (on cloud) & Jenkins (0) | 2023.05.12 |
크롤링 ( 웹 스크랩핑 ) #python #BeautifulSoup #csv (0) | 2023.05.10 |
세미 프로젝트 (0) | 2023.05.01 |