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
| #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 |
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
| #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': |
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 |
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
| """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. |
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
| ''' | |
| Leap Year Calculator | |
| If you put a year in number(like 1992 or 2000), the program will tell you whether it is leap year or not. | |
| ''' | |
| #Get an year number as an input | |
| year_input = int(input("Please enter a year that you want to know:")) |
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
| '''Array Practice | |
| <Table of Scores>: For Students A, B, C, D, E | |
| A B C D E | |
| Math 49 79 20 100 80 | |
| Computer 43 59 85 30 90 | |
| Foreign Language 49 79 48 60 100 | |
| Who got the better-than-average score from at least two out of 3 subjects? | |
| ''' |
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
| '''What Day Calculator based on 8 digits (yyyymmdd) | |
| Input of 8 digits(first four for year, next two for month, last two for day) | |
| Output = the exact day (like "Monday" or "Saturday") | |
| Remember, 0001 Jan 1st was Monday! | |
| ''' | |
| #Get an input: first 4 digits for year, next 2 digits for month, last 2 digits for day. | |
| #The input will be saved as a string |
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
| '''Class and inheritance | |
| base class = SchoolMember | |
| sub classes = Teacher, Student | |
| ''' | |
| class SchoolMember: | |
| '''Represents any school member.''' | |
| def __init__(self, name, age): | |
| self.name = name |
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
| '''Palindrome Distinguisher | |
| From the input, it automatically tells you whether the input was palindrome or not | |
| It also inquire you if you want to play again. | |
| ''' | |
| #Reverse the words of input | |
| def reverse(text): | |
| return text[::-1] |
OlderNewer