파이썬으로 대석천 취미를 통일할 수 있는 게임을 몇 번 만들어봐요.
2551 단어 Python3
개요
"돌샘이 좋아요". Advent Calendar 2019. 중엑셀 VBA로 만든 거. 그냥 파이썬 공부하는 김에 추가했어요.import random
STRING = '大石泉すき'
i = 0
output = ''
n = len(STRING)
max = n - 1
while output != STRING:
output = ''
for _ in range(n):
location = random.randint(0, max)
output += STRING[location]
print(output)
i += 1
print('「{}」が揃うまで{}回かかりました。'.format(STRING, i))
상수 스트링에 좋아하는 글자를 넣고 놀 수 있다.
결과
Reference
이 문제에 관하여(파이썬으로 대석천 취미를 통일할 수 있는 게임을 몇 번 만들어봐요.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/tsuru2_mitsuru/items/787b67bc44baa6619ef5
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
import random
STRING = '大石泉すき'
i = 0
output = ''
n = len(STRING)
max = n - 1
while output != STRING:
output = ''
for _ in range(n):
location = random.randint(0, max)
output += STRING[location]
print(output)
i += 1
print('「{}」が揃うまで{}回かかりました。'.format(STRING, i))
Reference
이 문제에 관하여(파이썬으로 대석천 취미를 통일할 수 있는 게임을 몇 번 만들어봐요.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/tsuru2_mitsuru/items/787b67bc44baa6619ef5텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)