Skip to content

Instantly share code, notes, and snippets.

View chaewonkong's full-sized avatar

chaewonkong chaewonkong

View GitHub Profile
@chaewonkong
chaewonkong / FizzBuzz.py
Created November 29, 2017 08:33
FizzBuzz Program. Returns "Fizz" for multiples of 3, "Buzz" for multiples of 5, "FizzBuzz" for multiples of 15. It requires input number from the User, then generates list of numbers.
"""FizzBuzz Program
The program will return "Fizz" for multiples of 3, "Buzz" for multiples of 5, "FizzBuzz" for multiples of 15.
In Beginning, the program will require the user to give an input number(integer).
The input number will be used in making list of numbers.
The list of numbers are consist of integers from 1 to the input number.
Meaning: Range(1, input+1)
"""
#Get an input of an integer from the user.
@chaewonkong
chaewonkong / lotto.py
Last active November 29, 2017 08:38
Simple program that generates 6 sets of numbers in range(1, 46) for Lotto(Korea's the most popular lottery)
'''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
@chaewonkong
chaewonkong / rsp_game_redo.py
Last active November 26, 2017 08:13
Rocks Sissors Papers Game program with 'Try Again' for draw situation. After playing, it asks yes no question to play again or not.
#This is an python game of 'Rocks, Sissors, Papers'
#A User can compete with the computer by select one of 'r', 's', 'p', which indicates 'Rock', 'Sissor', and 'Paper'
#Computer, decides one of 'Rock', 'Sissor', 'Paper' as well, by using random.choice
#After playing one game, the program will ask you whether want to play another game or not.
import random
#Function that changes input of ['r', 's', 'p'] as output of ['Rock', 'Sissor', 'Paper']
def rsp_func(user):
if user == 'r':
@chaewonkong
chaewonkong / fibonacci.py
Last active December 6, 2017 08:01
Fibonacci Sequence: Getting integer input and prints nth fibonacci number as an output
#Fibonacci Sequence Study
#This program will find out 2 things:
#1)Whether the given number is in fibonacci sequence,
#2)If it is in the Fibonacci sequence, then shows the nth
n = int(input('Please enter an integer:'))
def fibo(n):
if n in [1,2]:
return 1