개발/Python

Lotto 6/45 (korea lottery) random generation pyscript version(v0.1)

강서버 2023. 4. 28. 22:44
반응형

 

lotto645.html
0.00MB

 

1. Download attached file(lotto645.html)

2. Double click the downloaded file (or Downloaded file open in browser)

 

1. 첨부파일 다운로드(lotto645.html)

2. 다운로드 파일 더블클릭 (또는 다운로드 파일 브라우저에서 열기)

 

html source :

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
    <script defer src="https://pyscript.net/latest/pyscript.js"></script>
  </head>

  <body>
    <h1>Lotto 6/45 (korea lottery)</h1>
    <p>version : 0.1</p>
    <p>date : 2023-04-28 (Y-M-D)</p>
    <p>author : gangserver</p>
    <form><input type="button" value="Refresh" onClick="window.location.reload()"></form>
    <py-script>
import random

i = 1
result = []

while True:
    pick = random.randint(1, 45)

    if pick not in result:
        print("%d - pick number : %d" % (i, pick))
        result.append(pick)
        i += 1

    if len(result) == 6:
        break

print("\nlotto 6/45 result : %s" % sorted(result))
    </py-script>
  </body>
</html>

 

Good luck~^^

 

반응형