#모듈 : 프로그램에서 사용할 함수, 변수, 자료들을 미리 모아둔 것
#import 모듈이름
import time
print(dir(time))
print(time.localtime())
time.sleep(0.5)
print(time.time())
import random as ran #모듈의 별명 만들기
print(dir(ran))
print(ran.randint(1, 100)) #1~100사이 랜덤 정수 뽑기
print(ran.random()) # 0~1사이 랜덤 실수
print(ran.choice([1, 2, 3, 4, 5]))
print(ran.sample('abcde', 3))
from math import pi
print(pi)
print('----문제----')
#공이 1~100m 사이 거리로 던져지는데 -> randint
ball = ran.randint(1, 100)
print(ball, 'm')
#던지고 나서 3초 뒤에 -> sleep
time.sleep(3)
#30m 이상 50m 이하이면 'win' 그 외는 'lose' -> 조건문 if - else
if 30 <= ball <= 50:
print('win')
else:
print('lose')
To embed this project on your website, copy the following code and paste it into your website's HTML: