[Python] 드레이븐과 함께하는 random 파이썬

정호석·2022년 5월 27일
2

평범한 게임에 질렸을때 사용하는 랜덤 Picker

파이썬 random 모듈을 사용하여
게임 유형, 포지션 , 사용불가 스펠을 랜덤으로 골라주는 app을 만들어보았습니다.

import random
arr = [
    ['소환사의 협곡(랭크)', '소환사의 협곡(일반)', '칼바람 나락', 'U.R.F 모드'],
    ['TOP', 'Jungle', 'Mid', 'ADC', 'Supporter'],
    ['점화', '탈진', '유체화', '정화', '회복', '점멸']
]
game = arr[0][random.randint(0, 3)]
position = arr[1][random.randint(0, 4)]
banned_spell = arr[2][random.randint(0, 5)]
print('★ ☆ ★ ☆  Welcome to LOL Random Play Application ★ ☆ ★ ☆')
print('Random Picker Result')
print('이번에 진행할 게임 = [' + game + ']')
print('포지션 = [' + position + ']')
print('사용 불가 스펠 = [' + banned_spell + ']')

random.randint(0, 3) -> 랜덤 모듈에 있는 정수형 숫자 0 에서 3 사이를 랜덤으로 골라주는 기능.

-- 결과화면 --


profile
welcome

0개의 댓글