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
| '''Dealing with Multi-line input | |
| by using EOFError, unless the user press ctrl+d, the program will keep get inputs and store it in the list. | |
| Finally the user press ctrl+d, all stored input in the list will printed line by line. | |
| ''' | |
| contents = [] | |
| while True: | |
| try: | |
| line = input() |
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
| '''Multiply Maximazer | |
| Get 4 numbers as an input. Split into two double digits number that generates the maximum number | |
| when they are multiplied by each other | |
| ''' | |
| def Multiply_Max(numbers): | |
| '''Sort the list reverse. Use indexing and make two double digits numbers a,b. | |
| The biggest number and the smallest number should be accompanied wheareas, middle 2 numbers should also be accompanied | |
| In order to calculate a*b, both a, b should be integers. change all the indexed to int. |
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
| '''Caesar Cypher encoder/decoder | |
| From input, this program will generate Caesar cypher(each alphabets of input will be changed 3 step forward alphabets | |
| in alphabet order. It will print the outcome. | |
| Then, the program will decode the generated Caesar cypher and print it. | |
| The user can compare her/his original input to the printed outcome. | |
| ''' |
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
| #General Features about computers | |
| class Computer: | |
| def __init__(self, model, cpu, ram, storage, os): | |
| self.model = model | |
| self.cpu = cpu | |
| self.ram = ram | |
| self.storage = storage | |
| self.os = os | |
| #Function that tell the features line by line |
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] |
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
| '''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
| '''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
| ''' | |
| 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:")) |