Last active
November 29, 2017 08:38
-
-
Save chaewonkong/ccd239db3e76bd2ad0ad162e00169829 to your computer and use it in GitHub Desktop.
Simple program that generates 6 sets of numbers in range(1, 46) for Lotto(Korea's the most popular lottery)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '''Random Number Generator for the Korean Lottery called "Lotto" | |
| This program generates random numbers for Korea's the most popular lottery "Lotto" | |
| In Korean Lotto, A buyer selects six sets of numbers, each of them is in range of 1 to 45(including 45) | |
| This program generates six sets of numbers in range(1, 46): Meaning 1 to 45 are included. | |
| ''' | |
| #Function for making 6 numbersets in range(1, 46). Random Sampling without REPLACEMENT. | |
| import random | |
| print("\nDo you want to generate numbersets for Lotto?") | |
| while True: | |
| #Ask the user whether he wants to generate numbersets for Lotto or not | |
| your_choice = input("Press 'y' for 'Yes' or 'n' for 'No':") | |
| if your_choice == 'y': #If the user says yes to run this program | |
| print("\nGenerated Lotto Numbers:", random.sample(range(1, 46), k=6), "\n\nDo you want to regenerate the numbers?") | |
| elif your_choice == 'n': #If the user says no | |
| break | |
| else: | |
| print("\nYou entered the wrong character. Please enter it again.") | |
| #When quitting the program | |
| print("\nByebye~\n\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment