├── LICENSE ├── README.md ├── Slides ├── English │ ├── Class1.pdf │ ├── Class2.pdf │ ├── Class3.pdf │ ├── Class4.pdf │ ├── Class5.pdf │ └── Class6.pdf └── Vietnamese │ ├── Class1.pdf │ ├── Class2.pdf │ ├── Class3.pdf │ ├── Class4.pdf │ ├── Class5.pdf │ └── Class6.pdf ├── Week0 ├── .DS_Store └── homework0.py ├── Week1 ├── homework1.py ├── homework2.py ├── inclass1.py ├── inclass2.py ├── sol_inclass1.py └── sol_inclass2.py ├── Week2 ├── homework3.py ├── homework4.py ├── inclass3.py ├── inclass4.py ├── sol_inclass3.py └── sol_inclass4.py ├── Week3 ├── midterm.py ├── review.py └── sol_midterm.py ├── Week4 ├── homework5.py ├── homework6.py ├── inclass5.py ├── inclass6.py ├── sol_homework5.py ├── sol_homework6.py ├── sol_inclass5.py └── sol_inclass6.py └── Week5 ├── project.py └── sol_project.py /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Hoang Cao Bao 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EGR101-VietCodeAcademy 2 | I desgin EGR101 courses (Introduction to programming Python) for begineers to learn Python in easiest and fatest way. 3 | 4 | ## Course syllabus: 5 | |Week | Topic | Practice | Homework | Slide | 6 | |---| -------- |--------|----------|--------| 7 | |1| Data type, variable, and basic syntax | inclass1.py | homework1.py | Class1.pdf | 8 | |1| Conditional statement | inclass2.py | homework2.py | Class2.pdf| 9 | |2| Loop | inclass3.py | homework3.py | Class3.pdf| 10 | |2| List | inclass4.py | homework4.py | Class4.pdf| 11 | |3| Midterm test | midterm.py | | | 12 | |3| Review all homework | review.py | | | 13 | |4| Function | inclass5.py | homework5.py | Class5.pdf | 14 | |4| Dictionary | inclass6.py | homework6.py | Class6.pdf| 15 | |5| Final project | project.py | | | 16 | 17 | ### HOANG CAO BAO 18 | 19 | -------------------------------------------------------------------------------- /Slides/English/Class1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangcaobao/Learning-Python-in-1-month/7c510056b95e1b79022ca3c4a1c8e22bf7b134d8/Slides/English/Class1.pdf -------------------------------------------------------------------------------- /Slides/English/Class2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangcaobao/Learning-Python-in-1-month/7c510056b95e1b79022ca3c4a1c8e22bf7b134d8/Slides/English/Class2.pdf -------------------------------------------------------------------------------- /Slides/English/Class3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangcaobao/Learning-Python-in-1-month/7c510056b95e1b79022ca3c4a1c8e22bf7b134d8/Slides/English/Class3.pdf -------------------------------------------------------------------------------- /Slides/English/Class4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangcaobao/Learning-Python-in-1-month/7c510056b95e1b79022ca3c4a1c8e22bf7b134d8/Slides/English/Class4.pdf -------------------------------------------------------------------------------- /Slides/English/Class5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangcaobao/Learning-Python-in-1-month/7c510056b95e1b79022ca3c4a1c8e22bf7b134d8/Slides/English/Class5.pdf -------------------------------------------------------------------------------- /Slides/English/Class6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangcaobao/Learning-Python-in-1-month/7c510056b95e1b79022ca3c4a1c8e22bf7b134d8/Slides/English/Class6.pdf -------------------------------------------------------------------------------- /Slides/Vietnamese/Class1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangcaobao/Learning-Python-in-1-month/7c510056b95e1b79022ca3c4a1c8e22bf7b134d8/Slides/Vietnamese/Class1.pdf -------------------------------------------------------------------------------- /Slides/Vietnamese/Class2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangcaobao/Learning-Python-in-1-month/7c510056b95e1b79022ca3c4a1c8e22bf7b134d8/Slides/Vietnamese/Class2.pdf -------------------------------------------------------------------------------- /Slides/Vietnamese/Class3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangcaobao/Learning-Python-in-1-month/7c510056b95e1b79022ca3c4a1c8e22bf7b134d8/Slides/Vietnamese/Class3.pdf -------------------------------------------------------------------------------- /Slides/Vietnamese/Class4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangcaobao/Learning-Python-in-1-month/7c510056b95e1b79022ca3c4a1c8e22bf7b134d8/Slides/Vietnamese/Class4.pdf -------------------------------------------------------------------------------- /Slides/Vietnamese/Class5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangcaobao/Learning-Python-in-1-month/7c510056b95e1b79022ca3c4a1c8e22bf7b134d8/Slides/Vietnamese/Class5.pdf -------------------------------------------------------------------------------- /Slides/Vietnamese/Class6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangcaobao/Learning-Python-in-1-month/7c510056b95e1b79022ca3c4a1c8e22bf7b134d8/Slides/Vietnamese/Class6.pdf -------------------------------------------------------------------------------- /Week0/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoangcaobao/Learning-Python-in-1-month/7c510056b95e1b79022ca3c4a1c8e22bf7b134d8/Week0/.DS_Store -------------------------------------------------------------------------------- /Week0/homework0.py: -------------------------------------------------------------------------------- 1 | #Exercise: run your first program 2 | 3 | print("Hello World!!!") -------------------------------------------------------------------------------- /Week1/homework1.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Assign value 5 to variable a and -3 to variable b and product of a and b to variable c. Then print c 2 | 3 | #Exercise 2: Use input ask address and city. 4 | # Print "I live in {0} , {1}" with 0 is address and 1 is city 5 | 6 | #Exercise 3: Use input ask 2 number: number1 and number2. Print number1/number2. 7 | -------------------------------------------------------------------------------- /Week1/homework2.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Use input ask year. 2 | #print "yes" if this year is leap year 3 | #print "no" if this year is not leap year 4 | 5 | 6 | #Exercise 2: Create a simple chat bot in terminal following these rules: 7 | #Firstly, use input ask name 8 | #Then print "Hello {0}, how can I help you" with 0 is the value of name 9 | #print "I can do 2 options. 1) calculate substraction of two numbers. 2) calculate division of two numbers" 10 | #Secondly, use input ask options (1 or 2) 11 | #Thirdly, use input ask 2 number: number1 and number2 12 | #If user choose 1 print substraction of number 1 and number 2 13 | #If user choose 2 print division of number 1 and number 2 -------------------------------------------------------------------------------- /Week1/inclass1.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Assign value 10 to variable x and print x 2 | 3 | #Exercise 2: Assign value "Vietcode academy" to variable x and print x 4 | 5 | #Exercise 3: Assign value 10 to varibale a and value 5 to variable b and print sum of a and b 6 | 7 | #Exercise 4: Assign sum of a and b to varibale c and print c 8 | 9 | #Exercise 5: Assign value "1000" to varibale x and assign intenger type of varible x to varible y and print y 10 | 11 | #Exercise 6: Reverse of exercise 5 12 | 13 | #Exercise 7: Use input ask a number, then print this number 14 | 15 | #Exercise 8: Use input ask 2 number, number1 and number2 16 | #Print "Number 1 is {0} and number 2 is {1}" with 0 is value of number1 and 1 is value of number2. -------------------------------------------------------------------------------- /Week1/inclass2.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Use input ask a number. Check this number is between 5 and 30 or not. 2 | # If correct print "between 5 and 30" 3 | # If not print "not between 5 and 30" 4 | 5 | #Exercise 2: Vietcode only recruits a person younger than 30 years old and live in Vietnam. 6 | #Use first input ask about age 7 | #Use second input ask about location 8 | #If qualified print "qualified" 9 | #If not print "not qualified" 10 | 11 | #Exercise 3: Teacher Bear love eating cakes but the amount of cakes depend on his emotion 12 | #If his emotion is happy he eats 30 cakes 13 | #If his emotion is nervous he eats 20 cakes 14 | #if his emotion is angry he eats 10 cakes 15 | #If his emotion is sad he eats 5 cakes 16 | #print "Teacher Bear eats {0} cakse" with 0 is the amount of cakes 17 | 18 | #Exercise 4: Create a simple chat bot in terminal following these rules: 19 | #Firtsly, print "I can do 2 options. 1) calculate sum of two numbers. 2) calculate product of two numbers" 20 | #Secondly, use input ask options (1 or 2) 21 | #Thirdly, use input ask 2 number: number1 and number2 22 | #If user choose 1 print sum of number 1 and number 2 23 | #If user choose 2 print product of number 1 and number 2 -------------------------------------------------------------------------------- /Week1/sol_inclass1.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Assign value 10 to variable x and print x 2 | x=10 3 | print(x) 4 | 5 | #Exercise 2: Assign value "Vietcode academy" to variable x and print x 6 | x="Vietcode academy" 7 | print(x) 8 | 9 | #Exercise 3: Assign value 10 to varibale a and value 5 to variable b and print sum of a and b 10 | a=10 11 | b=5 12 | print(a+b) 13 | 14 | #Exercise 4: Assign sum of a and b to varibale c and print c 15 | c=a+b 16 | print(c) 17 | 18 | 19 | #Exercise 5: Assign value "1000" to varibale x and assign intenger of varible x to varible y and print y 20 | x="1000" 21 | y=int(x) 22 | print(y) 23 | 24 | #Exercise 6: Reverse of exercise 5 25 | x=1000 26 | y=str(x) 27 | print(y) 28 | 29 | #Exercise 7: Use input ask a number, then print this number 30 | x=input() 31 | print(x) 32 | 33 | 34 | #Exercise 8: Use input ask 2 number, number1 and number2 35 | #Print "Number 1 is {0} and number 2 is {1}" with 0 is value of number1 and 1 is value of number2. 36 | x=input("Enter your first number: ") 37 | y=input("Enter your second number:") 38 | print("Number 1 is {0} and number 2 is {1}".format(x,y)) -------------------------------------------------------------------------------- /Week1/sol_inclass2.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Use input ask a number. Check this number is between 5 and 30 or not. 2 | # If correct print "between 5 and 30" 3 | # If not print "not between 5 and 30" 4 | number=int(input("Hi bro, enter your number: ")) 5 | if 5<=number and number<=30: 6 | print("between 5 and 30") 7 | else: 8 | print("not between 5 and 30") 9 | 10 | 11 | #Exercise 2: Vietcode only recruits a person younger than 30 years old and live in Vietnam. 12 | #Use first input ask about age 13 | #Use second input ask about location 14 | #If qualified print "qualified" 15 | #If not print "not qualified" 16 | age=input("Enter your age ") 17 | age=int(age) 18 | location=input("where do you live ") 19 | location=location.lower() 20 | if age<30 and location=="vietnam": 21 | print("qualified") 22 | else: 23 | print("not qualified") 24 | 25 | 26 | #Exercise 3: Teacher Bear love eating cakes but the amount of cakes depend on his emotion 27 | #If his emotion is happy he eats 30 cakes 28 | #If his emotion is nervous he eats 20 cakes 29 | #if his emotion is angry he eats 10 cakes 30 | #If his emotion is sad he eats 5 cakes 31 | #Use input to ask emotion 32 | #print "Teacher Bear eats {0} cakse" with 0 is the amount of cakes 33 | emotion=input("emotion today") 34 | emotion=emotion.lower() 35 | if emotion=="happy": 36 | amount=30 37 | elif emotion=="nervous": 38 | amount=20 39 | elif emotion=="angry": 40 | amount=10 41 | elif emotion=="sad": 42 | amount=5 43 | print("Teacher Bear eats {} cakse".format(amount)) 44 | 45 | 46 | #Exercise 4: Create a simple chat bot in terminal following these rules: 47 | #Firtsly, print "I can do 2 options. 1) calculate sum of two numbers. 2) calculate product of two numbers" 48 | #Secondly, use input ask options (1 or 2) 49 | #Thirdly, use input ask 2 number: number1 and number2 50 | #If user choose 1 print sum of number 1 and number 2 51 | #If user choose 2 print product of number 1 and number 2 52 | print(""" 53 | I can do 2 options. 54 | 1) calculate sum of two numbers. 55 | 2) calculate product of two numbers""") 56 | option=int(input("What options do you want to choose (1 or 2): ")) 57 | number1=int(input("Your first number ")) 58 | number2=int(input("Your second number")) 59 | if option==1: 60 | result=number1+number2 61 | else: 62 | result=number1*number2 63 | print("Your result is {}".format(result)) -------------------------------------------------------------------------------- /Week2/homework3.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Use for to print every square number between 1 and 100 2 | 3 | #Exercise 2: Use while to solve exercise 1 4 | 5 | #Exercise 3: Create a simple chat bot in terminal following these rules: 6 | #Firstly, use input ask name 7 | #Then print "Hello {0}, how can I help you" with 0 is the value of name 8 | #Use input ask current_money 9 | #print "I can do 2 options. 1) withdraw money 2) add more money" 10 | #Use input to ask option 11 | #If user choose 1 use input ask withdraw money 12 | #Then print "Now you have {0} $" with 0 is the current money AFTER WITHDRAW 13 | #If user choose 2 use input ask add money 14 | #Then print "Now you have {0) $" with 0 is the current money AFTER ADD 15 | #After print "Do you want to continue using chat bot (Y/N) ?" 16 | #Use input ask options (Y or N) 17 | #If N out terminal 18 | #If Y continue to ask again 19 | 20 | -------------------------------------------------------------------------------- /Week2/homework4.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Create a simple chat bot in terminal following these rules: 2 | #Firstly, use input ask name 3 | #Then print "Hello {0}, welcome to our service" with 0 is the value of name 4 | #Print current list refrigerator (if first time it is empty) 5 | #Print "We can do 2 options. 1) Add new food to refrigerator 2) remove food from refrigerator" 6 | #Use input to ask options 7 | #If user choose 1 use input ask new food 8 | #Print "Here is your refrigerator after adding new food" 9 | #Then print list refrigerator after add newfood 10 | #If user choose 2 print "Here is your current refrigerator" 11 | #Then print list refrigerator 12 | #Then use input to ask the index user want to remove 13 | #If this index is valid, print "Here is your refrigerator after removing food", then print list refrigerator 14 | #If not, print "The index you input must larger than {0} and smaller than {1}", then ask again until index is valid 15 | #After finishing print "Do you want to continue using chat bot (Y/N) ?" 16 | #Use input ask options (Y or N) 17 | #If N out terminal 18 | #If Y continue to ask again 19 | -------------------------------------------------------------------------------- /Week2/inclass3.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Use for to print every odd number between 1 and 100 in 2 different ways 2 | 3 | #Exercise 2: Use while to solve exercise 1 4 | 5 | #Exercise 3: Use continue and for to print all the numbers from 0 to 100 except number divided by 10. 6 | 7 | #Exercise 4: Use while to solve exercise 3 8 | 9 | #Exercise 5: Create a simple chat bot in terminal following these rules: 10 | #Firtsly, print "I can do 2 options. 1) calculate sum of two numbers. 2) calculate product of two numbers" 11 | #Secondly, use input ask options (1 or 2) 12 | #Thirdly, use input ask 2 number: number1 and number2 13 | #If user choose 1 print sum of number 1 and number 2 14 | #If user choose 2 print product of number 1 and number 2 15 | #After print "Do you want to continue using chat bot (Y/N) ?" 16 | #Use input ask options (Y or N) 17 | #If N out terminal 18 | #If Y continue to ask again 19 | 20 | -------------------------------------------------------------------------------- /Week2/inclass4.py: -------------------------------------------------------------------------------- 1 | numbers=[1,3,4,5,2] 2 | 3 | #Exercise 1: Do not use len(). print the length of list numbers. 4 | #Hint: Use for in list 5 | 6 | #Exercise 2: Use input to ask number. Add this number at the end of list numbers. 7 | 8 | #Exercise 3: Similar to exercise 2 but if add number already exist in list numbers. Do not add and print "This number already exists" 9 | 10 | #Exercise 4: Use input to ask index. 11 | #If this index is valid, remove element at this list at index 12 | #If not, print index is invalid 13 | 14 | #Exercise 5: Use input to ask number. Remove this number from list numbers if it exists 15 | 16 | #Exercise 6: Print all element larger than 3 in list numbers 17 | 18 | #Exercise 7: Print second smallest number and second largest number in list numbers 19 | 20 | #Exercise 8: Add even numbers from 1 to 100 to a new list and print it -------------------------------------------------------------------------------- /Week2/sol_inclass3.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Use for to print every odd number between 1 and 100 in 2 different way 2 | #Method 1: 3 | for i in range(1, 101): 4 | if (i%2 != 0): 5 | print(i) 6 | 7 | #Method 2: 8 | for i in range(1,101,2): 9 | print(i) 10 | 11 | #Exercise 2: Use while to solve exercise 1 12 | #Method 1: 13 | shiba=1 14 | while shiba<101: 15 | if (shiba%2!=0): 16 | print(shiba) 17 | shiba=shiba+1 18 | 19 | #Method 2: 20 | shiba=1 21 | while shiba <101: 22 | print(shiba) 23 | shiba=shiba+2 24 | 25 | #Exercise 3: Use for and continue to print all the numbers from 0 to 100 except number divided by 10. 26 | for shiba in range(0,101): 27 | if(shiba%10==0): 28 | continue 29 | print(shiba) 30 | 31 | #Exercise 4: Use while to solve exercise 3 32 | shiba=0 33 | while shiba<101: 34 | if shiba%10!=0: 35 | print(shiba) 36 | print(shiba) 37 | 38 | #Exercise 5: Create a simple chat bot in terminal following these rules: 39 | #Firtsly, print "I can do 2 options. 1) calculate sum of two numbers. 2) calculate product of two numbers" 40 | #Secondly, use input ask options (1 or 2) 41 | #Thirdly, use input ask 2 number: number1 and number2 42 | #If user choose 1 print sum of number 1 and number 2 43 | #If user choose 2 print product of number 1 and number 2 44 | #After print "Do you want to continue using chat bot (Y/N) ?" 45 | #Use input ask options (Y or N) 46 | #If N out terminal 47 | #If Y continue to ask again 48 | ask="Y" 49 | while ask=="Y": 50 | print( 51 | """ 52 | I can do 2 options. 53 | 1) calculate sum of two numbers. 54 | 2) calculate product of two numbers 55 | """ 56 | ) 57 | option=int(input("What option do you want to use (1 or 2) ")) 58 | number1=int(input("What is your number1 ? ")) 59 | number2=int(input("What is your number2 ? ")) 60 | if(option==1): 61 | result=number1+number2 62 | else: 63 | result=number1*number2 64 | print("Your result is {}".format(result)) 65 | ask=input("Do you want to continue using chat bot (Y/N) ? ") -------------------------------------------------------------------------------- /Week2/sol_inclass4.py: -------------------------------------------------------------------------------- 1 | numbers=[1,3,4,5,2] 2 | 3 | #Exercise 1: Do not use len(). print the length of list numbers. 4 | #Hint: Use for in list 5 | length=0 6 | for number in numbers: 7 | length=length+1 8 | print(length) 9 | 10 | #Exercise 2: Use input to ask number. Add this number at the end of list numbers. 11 | print(numbers) 12 | number=int(input("Your number: ")) 13 | numbers.append(number) 14 | print(numbers) 15 | numbers.insert(len(numbers), number) 16 | print(numbers) 17 | 18 | #Exercise 3: Similar to exercise 2 but if add number already exist in list numbers. Do not add and print "This number already exists" 19 | #Method 1: 20 | print(numbers) 21 | number=int(input("Your number: ")) 22 | already_exists=False 23 | for i in numbers: 24 | if i==number: 25 | already_exists=True 26 | break 27 | if already_exists==False: 28 | numbers.append(number) 29 | print(numbers) 30 | else: 31 | print("This number already exists") 32 | 33 | #Method 2: 34 | print(numbers) 35 | number=int(input("Your number: ")) 36 | if (number in numbers): 37 | print("This number already exists") 38 | else: 39 | numbers.append(number) 40 | print(numbers) 41 | 42 | #Exercise 4: Use input to ask index. 43 | #If this index is valid, remove element at this index in this list 44 | #If not, print index is invalid 45 | print(numbers) 46 | index=int(input("Your index you want to remove: ")) 47 | if index<=len(numbers)-1 and index>=0: 48 | numbers.pop(index) 49 | print(numbers) 50 | else: 51 | print("This index is invalid") 52 | 53 | 54 | #Exercise 5: Use input to ask number. Remove this number from list numbers if it exists 55 | print(numbers) 56 | number=int(input("Your number you want to delete: ")) 57 | if number in numbers: 58 | numbers.remove(number) 59 | print(numbers) 60 | else: 61 | print("Your number already not in list") 62 | 63 | #Exercise 6: Print all element larger than 3 in list numbers 64 | for number in numbers: 65 | if(number>3): 66 | print(number) 67 | 68 | #Exercise 7: Print second smallest number and second largest number in list numbers 69 | numbers.sort() 70 | print(numbers[1]) 71 | print(numbers[len(numbers)-2]) 72 | 73 | #Exercise 8: Add even numbers from 1 to 100 to a new list and print it 74 | new=[] 75 | for i in range(1,101): 76 | if(i%2==0): 77 | new.append(i) 78 | print(i) -------------------------------------------------------------------------------- /Week3/midterm.py: -------------------------------------------------------------------------------- 1 | #Week1 2 | #Exercise 1: Use input to ask name, age, and hometown. 3 | #Print Hello, my name is {}. I am {} years old and I live in {} 4 | 5 | #Exercise 2: Use input to ask 3 numbers 6 | #Print average of these 3 numbers 7 | 8 | #Exercise 3: Use input to ask gpa of student 9 | #If gpa bigger than 9.0 print excellent 10 | #if gpa bigger than 6.5 print good 11 | #If gpa bigger than 5.0 print average 12 | #Else print Weak 13 | 14 | #Exercise 4: Use input to ask a number 15 | #After that print result of number after going through flow chart in this link 16 | #https://drive.google.com/file/d/1CXpx60fYVfJGWxP79jlwADtn2aNjj1Ju/view?usp=sharing 17 | 18 | #Week2 19 | #Exercise 5: Use input to ask number 20 | #Print every number divisible by three from 1 to this number 21 | 22 | #Exercise 6: Use input to ask number 23 | #Print yes if this number is a prime number, else print no 24 | 25 | #We have list zoo = ['cat', 'elephant', 'panda', 'lion'] 26 | #Exercise 7: Print the number of animal in zoo 27 | #Exercise 8: Use input to ask a animal 28 | #If this animal is not already in zoo print zoo after adding this animal 29 | #Else print This animal already in zoo and ask again (#Hint: use while) 30 | 31 | -------------------------------------------------------------------------------- /Week3/review.py: -------------------------------------------------------------------------------- 1 | #homework1 2 | #Exercise 1: Assign value 5 to variable a and -3 to variable b and product of a and b to variable c. Then print c 3 | a=5 4 | b=-3 5 | c=a*b 6 | print(c) 7 | 8 | # #Exercise 2: Use input ask address and city. 9 | # Print "I live in {0} , {1}" with 0 is address and 1 is city 10 | adress=input() 11 | city=input() 12 | print("I live in {0} , {1}".format(adress,city)) 13 | 14 | #Exercise 3: Use input ask 2 number: number1 and number2. Print divison of number1 and number2. 15 | number1=float(input()) 16 | number2=float(input()) 17 | print(number1/number2) 18 | 19 | #homework2 20 | #Exercise 1: Use input ask year. 21 | #Pseudocode: 22 | #print "yes" if this year is leap year 23 | #print "no" if this year is not leap year 24 | # year=int(input()) 25 | # if year%4==0: 26 | # print("yes") 27 | # else: 28 | # print("no") 29 | # if (year is not divisible by 4) then (it is a common year) 30 | # else if (year is not divisible by 100) then (it is a leap year) 31 | # else if (year is not divisible by 400) then (it is a common year) 32 | # else (it is a leap year) 33 | 34 | year=int(input()) 35 | if(year%4!=0): 36 | print("no") 37 | elif (year%100!=0): 38 | print("yes") 39 | elif (year%400!=0): 40 | print("no") 41 | else: 42 | print("yes") 43 | 44 | 45 | #Exercise 2: Create a simple chat bot in terminal following these rules: 46 | #Firstly, use input ask name 47 | #Then print "Hello {0}, how can I help you" with 0 is the value of name 48 | #print "I can do 2 options. 1) calculate substraction of two numbers. 2) calculate division of two numbers" 49 | #Secondly, use input ask options (1 or 2) 50 | #Thirdly, use input ask 2 number: number1 and number2 51 | #If user choose 1 print substraction of number 1 and number 2 52 | #If user choose 2 print division of number 1 and number 2 53 | 54 | name=input() 55 | print( "Hello {0}, how can I help you".format(name)) 56 | print(""" 57 | I can do 2 options. 58 | 1) calculate substraction of two numbers. 59 | 2) calculate division of two numbers 60 | """) 61 | option=input("Your option: ") 62 | while option!="1" and option!="2": 63 | print("You can only choose 1 or 2. Not type other thing") 64 | option=input("Type your option again: ") 65 | option=int(option) 66 | number1=int(input("Number 1: ")) 67 | number2=int(input("NUmber 2: ")) 68 | if option==1: 69 | print(number1-number2) 70 | else: 71 | print(number1/number2) 72 | 73 | #Check type wrong option 74 | # name=input() 75 | # print( "Hello {0}, how can I help you".format(name)) 76 | # print(""" 77 | # I can do 2 options. 78 | # 1) calculate substraction of two numbers. 79 | # 2) calculate division of two numbers 80 | # """) 81 | option=input("Your option") 82 | type_correctly=False 83 | while type_correctly==False: 84 | if option=="1" or option=="2": 85 | type_correctly=True 86 | else: 87 | option=input("You type wrongly. Your option: ") 88 | option=int(option) 89 | number1=int(input("Number 1: ")) 90 | number2=int(input("Number 2: ")) 91 | if option==1: 92 | print(number1-number2) 93 | else: 94 | print(number1/number2) 95 | 96 | #Homework3 97 | #Exercise 1: Use for to print every square number between 1 and 100 98 | #Method 1 99 | import math 100 | number=math.sqrt(100) 101 | number=int(number) 102 | 103 | #Method 2 104 | for i in range(1, 11): 105 | print(i*i) 106 | 107 | #Method 3 108 | import math 109 | for i in range(1,101): 110 | if(int(math.sqrt(i))==math.sqrt(i)): 111 | print(i) 112 | 113 | #Exercise 2: Use while to solve exercise 1 114 | import math 115 | number=math.sqrt(100) 116 | number=int(number) 117 | i=0 118 | while i<=number: 119 | print(i*i) 120 | 121 | #Exercise 3: Create a simple chat bot in terminal following these rules: 122 | #Firstly, use input ask name 123 | #Then print "Hello {0}, how can I help you" with 0 is the value of name 124 | #Use input ask current_money 125 | #print "I can do 2 options. 1) withdraw money 2) add more money" 126 | #Use input to ask option 127 | #If user choose 1 use input ask withdraw money 128 | #Then print "Now you have {0} $" with 0 is the current money AFTER WITHDRAW 129 | #If user choose 2 use input ask add money 130 | #Then print "Now you have {0) $" with 0 is the current money AFTER ADD 131 | #After print "Do you want to continue using chat bot (Y/N) ?" 132 | #Use input ask options (Y or N) 133 | #If N out terminal 134 | #If Y continue to ask again 135 | # name=input("Your name: ") 136 | # print("Hello {0}, how can I help you".format(name)) 137 | # current_money=int(input()) 138 | # print(""" 139 | # I can do 2 options. 140 | # 1) withdraw money 141 | # 2) add more money 142 | # """) 143 | ask="Y" 144 | option=int(input()) 145 | while ask=="Y": 146 | if(option==1): 147 | withdraw_money=int(input("Amount of money you want to withdraw")) 148 | current_money-=withdraw_money 149 | print("Now you have {0} $".format(current_money)) 150 | else: 151 | add_money=int(input("Amount of money you want to withdraw")) 152 | current_money+=add_money 153 | print("Now you have {0) $".format(current_money)) 154 | ask=input("Do you want to continue using chat bot (Y/N) ?") 155 | 156 | #homework4 157 | #Exercise 1: Create a simple chat bot in terminal following these rules: 158 | #Firstly, use input ask name 159 | #Then print "Hello {0}, welcome to our service" with 0 is the value of name 160 | #Print current list refrigerator (if first time it is empty) 161 | #Print "We can do 2 options. 1) Add new food to refrigerator 2) remove food from refrigerator" 162 | #Use input to ask options 163 | #If user choose 1 use input ask new food 164 | #Print "Here is your refrigerator after adding new food" 165 | #Then print list refrigerator after add newfood 166 | #If user choose 2 print "Here is your current refrigerator" 167 | #Then print list refrigerator 168 | #Then use input to ask the index user want to remove 169 | #If this index is valid, print "Here is your refrigerator after removing food", then print list refrigerator 170 | #If not, print "The index you input must larger than {0} and smaller than {1}", then ask again until index is valid 171 | #After finishing print "Do you want to continue using chat bot (Y/N) ?" 172 | #Use input ask options (Y or N) 173 | #If N out terminal 174 | #If Y continue to ask again 175 | 176 | name=input() 177 | print("Hello {0}, welcome to our service".format(name)) 178 | refrigerator=[] 179 | print(refrigerator) 180 | print(""" 181 | We can do 2 options. 182 | 1) Add new food to refrigerator 183 | 2) remove food from refrigerator 184 | """) 185 | option=int(input()) 186 | ask="Y" 187 | while ask=="Y": 188 | if(option==1): 189 | add_food=input() 190 | refrigerator.append(add_food) 191 | else: 192 | print("Here is your current refrigerator") 193 | print(refrigerator) 194 | index=int(input()) 195 | index_valid=False 196 | while index_valid==False: 197 | if index>=0 and index<=len(refrigerator)-1: 198 | refrigerator.pop(index) 199 | index_valid=True 200 | else: 201 | print("The index you input must larger than {0} and smaller than {1}".format(-1, len(refrigerator))) 202 | index=int(input()) 203 | ask=input("Do you want to continue using chat bot (Y/N) ?") 204 | -------------------------------------------------------------------------------- /Week3/sol_midterm.py: -------------------------------------------------------------------------------- 1 | #Week1 2 | #Exercise 1: Use input to ask name, age, and hometown. 3 | #Print Hello, my name is {}. I am {} years old and I live in {} 4 | name=input("Enter your name: ") 5 | age=input("Enter your age: ") 6 | hometown=input("Enter your hometown: ") 7 | print("Hello, my name is {}. I am {} years old and I live in {}".format(name, age, hometown)) 8 | 9 | #Exercise 2: Use input to ask 3 numbers 10 | #Print average of these 3 numbers 11 | number1=float(input("Enter your number1: ")) 12 | number2=float(input("Enter your number2: ")) 13 | number3=float(input("Enter your number3: ")) 14 | print((number1+number2+number3)/3) 15 | 16 | #Exercise 3: Use input to ask gpa of student 17 | #If gpa bigger than 9.0 print excellent 18 | #if gpa bigger than 6.5 print good 19 | #If gpa bigger than 5.0 print average 20 | #Else print Weak 21 | gpa=float(input("Your gpa: ")) 22 | if gpa>=9: 23 | print("excellent") 24 | elif gpa>=6.5: 25 | print("good") 26 | elif gpa>=5.0: 27 | print("average") 28 | 29 | #Exercise 4: Use input to ask a number 30 | #After that print result of number after going through flow chart in this link 31 | #https://drive.google.com/file/d/1CXpx60fYVfJGWxP79jlwADtn2aNjj1Ju/view?usp=sharing 32 | x=int(input("enter your number: ")) 33 | if(x<5): 34 | x=x*10 35 | if(x<2): 36 | x=x-6 37 | else: 38 | x=x+5 39 | elif (x>10): 40 | x=x*x 41 | else: 42 | x=x*6 43 | print(x) 44 | 45 | 46 | #Week2 47 | #Exercise 5: Use input to ask number 48 | #Print every number divisible by three from 1 to this number 49 | number=int(input("Enter your number: ")) 50 | for i in range(1,number+1): 51 | if(i%3==0): 52 | print(i) 53 | 54 | #Exercise 6: Use input to ask number 55 | #Print yes if this number is a prime number, else print no 56 | #Method 1: 57 | prime=True 58 | number=int(input("Enter your number: ")) 59 | for i in range(2, number): 60 | if(number%i==0): 61 | prime = False 62 | break 63 | if prime==True: 64 | print("Yes") 65 | else: 66 | print("No") 67 | 68 | #Method 2: 69 | count=0 70 | number=int(input("Enter your number: ")) 71 | for i in range(1, number+1): 72 | if(number%i==0): 73 | count+=1 74 | if(count==2): 75 | print("Yes") 76 | else: 77 | print("No") 78 | 79 | #We have list zoo = ['cat', 'elephant', 'panda', 'lion'] 80 | #Exercise 7: Print the number of animal in zoo 81 | zoo = ['cat', 'elephant', 'panda', 'lion'] 82 | print(len(zoo)) 83 | 84 | #Exercise 8: Use input to ask a animal 85 | #If this animal is not already in zoo print zoo after adding this animal 86 | #Else print This animal already in zoo and ask again (#Hint: use while) 87 | repeat=True 88 | while repeat: 89 | animal=input("Enter your animal: ") 90 | if animal in zoo: 91 | print("This animal already in zoo") 92 | else: 93 | zoo.append(animal) 94 | repeat=False 95 | 96 | -------------------------------------------------------------------------------- /Week4/homework5.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Crate function with three parameter a, b, and c, to PRINT "YES" if c between a and b, else print "NO" 2 | 3 | #Exercise 2: Create function with parameter n to PRINT triangle with * following this rule: 4 | #If n is 1, triangle is: 5 | # * 6 | 7 | #If n is 2, triangle is: 8 | # * 9 | # ** 10 | 11 | #If n is 3, triangle is: 12 | # * 13 | # ** 14 | # *** 15 | 16 | #If n is 4, triangle is: 17 | # * 18 | # ** 19 | # *** 20 | # **** 21 | 22 | #Exercise 3: Create a function with parameter n to RECEIVE value is square of n 23 | 24 | -------------------------------------------------------------------------------- /Week4/homework6.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Create a simple chatbot following these rules: 2 | #Firstly, create a dictionary named manage_subjects 3 | #Use input to ask number of subjects want to manage 4 | #After that use input to ask each name of subject and its score (out of 10) and add them to dictionary 5 | #Secondly print "We can do 2 options. 1) Check every subjects with score lower than 5 2) print average score of all subjects 3) add new subject score or change subject score" 6 | #Use input to ask options 7 | #If user choose 1 8 | #Print "Here is a list of your weak subjects {0}" with 0 is a value of list contain every weak subjects 9 | #If user choose 2 10 | #Print "Here is your average scores: {0}" with 0 is a average score 11 | #If user choose 3 12 | #Use input to ask name of subject and its score and add it to or change it in dictionary 13 | #After finishing print "Do you want to continue using chat bot (Y/N) ?" 14 | #Use input ask options (Y or N) 15 | #If N out terminal 16 | #If Y continue to ask again -------------------------------------------------------------------------------- /Week4/inclass5.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Create function with parameter n to print all square number from 1 to n 2 | 3 | #Exercise 2: Create function with parameter list a to print sum of all number divided by 3 in list a 4 | 5 | #Exercise 3: Create function with parameter n to receive True if n is a leap year, else recieve False 6 | 7 | #Exercise 4: Create function with parameter n to receive n factorial 8 | 9 | #Exercise 5: Create function with parameter list a and number n to recieve True if n in a, else receive False 10 | 11 | #Exercise 6: Create function with parameter list a to receive reverse of list a -------------------------------------------------------------------------------- /Week4/inclass6.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Use input to ask a number. 2 | #Create a dictionary named square_numbers with key is from 1 to number and value is square of its key 3 | 4 | #Exercise 2: Print average of all value in square_numbers 5 | 6 | #Excersie 3: number=[1,1,1,2,2,3,3,4,4,4,5,5] 7 | #Create a dictionary named frequency with key is a element in list number and value is number of this element appears 8 | 9 | #Exercise 4: Create a simple chat bot following these rules: 10 | #Firstly, create a empty dictionary named students 11 | #Secondly, use input to ask number of students want to add 12 | #After use input to ask name of each students and their weigth and add them to dictionary 13 | #Thirdly, ask what student do you want to see his weight 14 | #After print this student's weight 15 | #Finally, print "Do you want to continue using chat bot (Y/N) ?" 16 | #Use input ask options (Y or N) 17 | #If N out terminal 18 | #If Y continue to ask again -------------------------------------------------------------------------------- /Week4/sol_homework5.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Crate function with three parameter a, b, and c, to PRINT "YES" if c between a and b, else print "NO" 2 | 3 | def check(a,b,c): 4 | if (b-c)*(c-a)>0: 5 | return 'Yes' 6 | else: 7 | return 'No' 8 | print(check(-3,6,-4)) 9 | 10 | #Exercise 2: Create function with parameter n to PRINT triangle with * following this rule: 11 | #If n is 1, triangle is: 12 | # * 13 | 14 | #If n is 2, triangle is: 15 | # * 16 | # ** 17 | 18 | #If n is 3, triangle is: 19 | # * 20 | # ** 21 | # *** 22 | 23 | #If n is 4, triangle is: 24 | # * 25 | # ** 26 | # *** 27 | # **** 28 | 29 | def triangle(n): 30 | for i in range(1,n+1): 31 | print('*'*i) 32 | triangle(4) 33 | 34 | #Exercise 3: Create a function with parameter n to RECEIVE value is square of n 35 | def square(n): 36 | return n**2 37 | print(square(10)) -------------------------------------------------------------------------------- /Week4/sol_homework6.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Create a simple chatbot following these rules: 2 | #Firstly, create a dictionary named manage_subjects 3 | #Use input to ask number of subjects want to manage 4 | #After that use input to ask each name of subject and its score (out of 10) and add them to dictionary 5 | #Secondly print "We can do 2 options. 1) Check every subjects with score lower than 5 2) print average score of all subjects 3) add new subject score or change subject score" 6 | #Use input to ask options 7 | #If user choose 1 8 | #Print "Here is a list of your weak subjects {0}" with 0 is a value of list contain every weak subjects 9 | #If user choose 2 10 | #Print "Here is your average scores: {0}" with 0 is a average score 11 | #If user choose 3 12 | #Use input to ask name of subject and its score and add it to or change it in dictionary 13 | #After finishing print "Do you want to continue using chat bot (Y/N) ?" 14 | #Use input ask options (Y or N) 15 | #If N out terminal 16 | #If Y continue to ask again 17 | 18 | manage_subjects={} 19 | 20 | number=int(input("Enter your number of subjects: ")) 21 | 22 | for i in range(1, number+1): 23 | name=input("name of subject {}: ". format(i)) 24 | score=float(input("score of subject {} (out of 10): ". format(i))) 25 | manage_subjects[name]=score 26 | 27 | print(""" 28 | We can do 3 options. 29 | 1) Check every subjects with score lower than 5 30 | 2) print average score of all subject 31 | 3) add new subject score or change subject score 32 | """) 33 | 34 | ask="Y" 35 | while ask=="Y": 36 | option=int(input("enter your option (1,2 or 3): ")) 37 | if option==1: 38 | list=[] 39 | for score in manage_subjects: 40 | if manage_subjects[score]<5: 41 | list.append(score) 42 | print("Here is a list of your weak subjects {}". format(list)) 43 | 44 | elif option==2: 45 | s=0 46 | for score in manage_subjects: 47 | s+=manage_subjects[score] 48 | print("Here is your average scores: {}". format(s/number)) 49 | 50 | else: 51 | new_name=input("enter your name of subject: ") 52 | new_score=float(input("enter your score of subject (out of 10): ")) 53 | manage_subjects[new_name]=new_score 54 | print(manage_subjects) 55 | 56 | ask=input("Do you want to continue using chat bot (Y/N)? ") -------------------------------------------------------------------------------- /Week4/sol_inclass5.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Create function with parameter n to print all square number from 1 to n 2 | def print_squre_numbers(n): 3 | for i in range(1,n+1): 4 | if(int(i**(1/2))==i**(1/2)): 5 | print(i) 6 | 7 | print_squre_numbers(12) 8 | 9 | #Exercise 2: Create function with parameter list a to print sum of all number divisible by 3 in list a 10 | def print_numbers_divisible_by_3(a): 11 | for i in a: 12 | if(i%3==0): 13 | print(i) 14 | 15 | print_numbers_divisible_by_3([1,3,5,7,12,9]) 16 | 17 | #Exercise 3: Create function with parameter n to receive True if n is a leap year, else recieve False 18 | def is_Leap_Year(n): 19 | if(n%4==0): 20 | return True 21 | else: 22 | return False 23 | 24 | print(is_Leap_Year(100)) 25 | 26 | #Exercise 4: Create function with parameter n to receive n factorial 27 | def factorial(n): 28 | result=1 29 | for i in range(1,n+1): 30 | result=result*1 31 | return result 32 | 33 | #Exercise 5: Create function with parameter list a and number n to recieve True if n in a, else receive False 34 | def check_number_in_list(n,a): 35 | if n in a: 36 | return True 37 | else: 38 | return False 39 | 40 | #Exercise 6: Create function with parameter list a to receive reverse of list a 41 | def reverse_list(a): 42 | result=[] 43 | for i in range(len(a)-1, -1, -1): 44 | result.append(a[i]) 45 | return result -------------------------------------------------------------------------------- /Week4/sol_inclass6.py: -------------------------------------------------------------------------------- 1 | #Exercise 1: Use input to ask a number. 2 | #Create a dictionary named square_numbers with key is from 1 to number and value is square of its key 3 | number=int(input("Nhap mot so")) 4 | square_numbers={} 5 | for i in range(1, number+1): 6 | square_numbers[i]=i**2 7 | print(square_numbers) 8 | 9 | #Exercise 2: Print average of all value in square_numbers 10 | sum=0 11 | for key in square_numbers: 12 | sum+=square_numbers[key] 13 | print(sum/number) 14 | 15 | #Excersie 3: number=[1,1,1,2,2,3,3,4,4,4,5,5] 16 | #Create a dictionary named frequency with key is a element in list number and value is number of this element appears 17 | number=[1,1,1,2,2,3,3,4,4,4,5,5] 18 | freqency={} 19 | #Method 1: 20 | for i in number: 21 | if(i in freqency): 22 | freqency[i]+=1 23 | else: 24 | freqency[i]=0 25 | #Method 2: 26 | for i in number: 27 | if i not in freqency: 28 | freqency[i]=0 29 | freqency[i]+=1 30 | 31 | #Exercise 4: Create a simple chat bot following these rules: 32 | #Firstly, create a empty dictionary named students 33 | #Secondly, use input to ask number of students want to add 34 | #After use input to ask name of each students and their weigth and add them to dictionary 35 | #Thirdly, ask what student do you want to see his weight 36 | #After print this student's weight 37 | #Finally, print "Do you want to continue using chat bot (Y/N) ?" 38 | #Use input ask options (Y or N) 39 | #If N out terminal 40 | #If Y continue to ask again 41 | students={} 42 | number=int(input("Your number of students: ")) 43 | for i in range(1, number+1): 44 | name=input("Student {} ".format(i)) 45 | weight=int(input("Weight of student {} ".format(i))) 46 | students[name]=weight 47 | 48 | ask="Y" 49 | while ask=="Y": 50 | name=input("Student you want to see weight ") 51 | print(students[name]) 52 | ask=input("Do you want to continue using chat bot (Y/N)") 53 | -------------------------------------------------------------------------------- /Week5/project.py: -------------------------------------------------------------------------------- 1 | #Create a simple version of Projectube 2 | #When run program: 3 | #1. Use program 4 | #2. Stop program 5 | #If user choose 2 stop program immediately 6 | #If user choose 1: 7 | #1. User 8 | #2. Orgination 9 | #Then even user choose 1 or 2: 10 | #1. Sign in 11 | #2. Sign up 12 | #If user choose 1: 13 | # Email: 14 | # Password: 15 | #If email and password is not correct ask email and password again 16 | #If user choose 2: 17 | # Email: 18 | # Password: 19 | # Confirm password: 20 | #If 2 passowrd is not the same ask email and 2 password again 21 | #After user login as a User 22 | #1. See events 23 | #2. See orgs 24 | #If user choose 1 list all current events with their number 25 | #If user choose number print decriptions of this events 26 | #If user choose 2 list all current organizations with their number 27 | #If user choose number print decriptions of this organization 28 | #Then: 29 | #1. Continue to see 30 | #2. Logout 31 | #If user choose 1 return to ask see events or see orgs 32 | #If user choose 2 return to ask use program or stop program 33 | #after user login as a Organization 34 | #If this organation is new ask their description 35 | #After that 36 | #1. See events 37 | #2. See orgs 38 | #3. Create events 39 | #If user choose 1 or 2 will be the same action above 40 | #If use choose 3 41 | #Ask how many events want to add (maximum 5) 42 | #Then ask name of events and description 43 | #Then: 44 | #1. Continue to see or creaete event 45 | #2. Logout 46 | #If user choose 1 return to ask see events or see orgs or create events 47 | #If user choose 2 return to ask use program or stop programs -------------------------------------------------------------------------------- /Week5/sol_project.py: -------------------------------------------------------------------------------- 1 | #Create a simple version of Projectube 2 | #When run program: 3 | #1. Use program 4 | #2. Stop program 5 | #If user choose 2 stop program immediately 6 | #If user choose 1: 7 | #1. User 8 | #2. Orgination 9 | #Then even user choose 1 or 2: 10 | #1. Sign in 11 | #2. Sign up 12 | #If user choose 1: 13 | # Email: 14 | # Password: 15 | #If email and password is not correct ask email and password again 16 | #If user choose 2: 17 | # Email: 18 | # Password: 19 | # Confirm password: 20 | #If 2 passowrd is not the same ask email and 2 password again 21 | #After user login as a User 22 | #1. See events 23 | #2. See orgs 24 | #If user choose 1 list all current name of events with their number 25 | #If user choose number print decriptions of this events 26 | #If user choose 2 list all current name of organizations with their number 27 | #If user choose number print decriptions of this organization 28 | #Then: 29 | #1. Continue to see 30 | #2. Logout 31 | #If user choose 1 return to ask see events or see orgs 32 | #If user choose 2 return to ask use program or stop program 33 | #After user login as a Organization 34 | #If this organation is new ask their description 35 | #After that 36 | #1. See events 37 | #2. See orgs 38 | #3. Create events 39 | #If user choose 1 or 2 will be the same action above 40 | #If use choose 3 41 | #Ask how many events want to add (maximum 5) 42 | #If number larger than 5 ask again 43 | #Then ask name of events and description 44 | #Then: 45 | #1. Continue to see or creaete event 46 | #2. Logout 47 | #If user choose 1 return to ask see events or see orgs or create events 48 | #If user choose 2 return to ask use program or stop programs 49 | def create_events(events, des_events): 50 | repeat=True 51 | while repeat: 52 | number=int(input("How many events you want to add: ")) 53 | if number>5: 54 | print("your number of events is too large. do you want to ask again? ") 55 | else: 56 | repeat=False 57 | for i in range(1, number+1): 58 | name=input("enter your name of event {}". format(i)) 59 | des=input("enter your description {}". format(i)) 60 | events.append(name) 61 | des_events.append(des) 62 | 63 | def orgs_actions(events, des_events, orgs, des_orgs): 64 | print( 65 | """ 66 | 1. See events 67 | 2. See orgs 68 | 3. Create events 69 | """) 70 | option=input() 71 | if(option=="1"): 72 | for i in range(0, len(events)): 73 | print("{0}, {1}".format(i,events[i])) 74 | 75 | repeat=True 76 | while repeat==True: 77 | number=int(input()) 78 | if number>=0 and number=0 and number=0 and number=0 and number