├── Assignment1 ├── README.md ├── solution2.py ├── solution3.py └── solution4.py ├── Assignment10(SQL) ├── DELETE.sql ├── INSERT_INTO_CUSTOMERS.sql ├── INSERT_INTO_PRODUCTS.sql ├── README.md ├── SELECT.sql ├── UPDATE.sql └── digikala_database.db ├── Assignment2 ├── README.md ├── calculator.py ├── palam_polom_pilish.py ├── rock_paper_Scissors.py ├── second to hour.py └── time to second.py ├── Assignment3 ├── KMM && BMM.py ├── README.md ├── hangman.py ├── is_armetrong.py ├── is_factorial.py ├── number_sentenc.py ├── random_Array.py └── sort_array.py ├── Assignment4 ├── Multiplication_table.py ├── README.md ├── chesstable.py ├── fibo.py ├── photo_2021-10-22_19-30-52.jpg └── tictaktoe.py ├── Assignment5 ├── README.md ├── database.csv ├── database.txt └── store.py ├── Assignment6 ├── README.md ├── translate.py └── words_bank.txt ├── Assignment7 ├── Khayam-Pascal.py ├── README.md ├── Symmetrical.py └── wedding.py ├── Assignment8 ├── README.md ├── complex_numbers.py ├── faraction.py └── time.py ├── Assignment9 ├── README.md ├── calculator.py └── design.ui └── README.md /Assignment1/README.md: -------------------------------------------------------------------------------- 1 | # Assignment 1 : 2 | ```Several operating system applications``` : 3 | #### ```arch``` : Indicates whether the system is 32-bit or 64-bit 4 | #### ```uptime``` : Indicates the current running time of the system and the average system load and the number of users logged into the system 5 | #### ```free``` : Indicates the amount of memory consumed by the system 6 | #### ```Pwd``` : Prints the name of the current work path in its entirety, abbreviated as Print Working Directory 7 | #### ```exit``` : The command is to exit and close the terminal 8 | 9 | ### Solotion 2: 10 | #### Calculate the circumference and area of a circle . 11 | 12 | ### Solution 3 : 13 | #### Geometry donor theorem . 14 | 15 | ### Solution 4 : 16 | #### Calculate BMI a Person . 17 | -------------------------------------------------------------------------------- /Assignment1/solution2.py: -------------------------------------------------------------------------------- 1 | r = float(input("Enter Radius :")) 2 | perimeter = 2 * 3.14 * r 3 | area = 3.14 * r * r 4 | print("Perimeter of the circle = " ,perimeter) 5 | print('Area of the circle = ',area) 6 | -------------------------------------------------------------------------------- /Assignment1/solution3.py: -------------------------------------------------------------------------------- 1 | IsTriangle = True 2 | a = float(input("Enter number 1 :")) 3 | b = float(input("Enter number 2 :")) 4 | c = float(input("Enter number 3 :")) 5 | if (a + b < c) : 6 | IsTriangle = False 7 | if(c + b < a ): 8 | IsTriangle = False 9 | if(c + a < b ): 10 | IsTriangle = False 11 | if (IsTriangle): 12 | print("we can make Triangle") 13 | else: 14 | print("we cant make Triangle") 15 | 16 | -------------------------------------------------------------------------------- /Assignment1/solution4.py: -------------------------------------------------------------------------------- 1 | height = float(input("Enter Ur height :")) 2 | weight = float(input("Enter Ur weight :")) 3 | if(weight/(height*height) <= 18.5): 4 | print("you are UnderWeight ") 5 | elif(18.5 < weight/(height*height) <= 24.9): 6 | print("you are Normal ") 7 | elif(25 < weight/(height*height) <= 29.9): 8 | print("you are OverWeight ") 9 | elif(30 < weight/(height*height) <= 34.9): 10 | print("you are Obese ") 11 | elif(weight/(height*height) > 35): 12 | print("you are ExtranllyObese ") 13 | 14 | -------------------------------------------------------------------------------- /Assignment10(SQL)/DELETE.sql: -------------------------------------------------------------------------------- 1 | DELETE FROM Customers 2 | WHERE NOT country = 'iran'; -------------------------------------------------------------------------------- /Assignment10(SQL)/INSERT_INTO_CUSTOMERS.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO Customers 2 | VALUES ('5','zohre','shiraz','iran'); 3 | -------------------------------------------------------------------------------- /Assignment10(SQL)/INSERT_INTO_PRODUCTS.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO Products 2 | VALUES ('6','iphone14','50000000','0'); 3 | -------------------------------------------------------------------------------- /Assignment10(SQL)/README.md: -------------------------------------------------------------------------------- 1 | # Assignment10 (SQL): 2 | ### Problem description: 3 | Create a database for Digikala with two tables : 4 | - 1- Enter the desired information into the table using the **INSERT** command. 5 | - 2- Show only available items using the **SELECT** command. 6 | - 3- Use the **DELETE** command to delete non-Iranian customers. 7 | - 4- Reduce the price of all items by 20% using the **UPDATE** command. 8 | 9 | Powerd by sqlitebrowser.org 10 | ### Certificate: 11 | Sololearn.com 12 | ![png](https://user-images.githubusercontent.com/91725214/157819260-c03c5293-0a5d-4ce4-a967-c1821e041be6.png) 13 | -------------------------------------------------------------------------------- /Assignment10(SQL)/SELECT.sql: -------------------------------------------------------------------------------- 1 | SELECT * FROM Products 2 | WHERE count > 0; -------------------------------------------------------------------------------- /Assignment10(SQL)/UPDATE.sql: -------------------------------------------------------------------------------- 1 | UPDATE Products 2 | SET price = price - (price * 20 / 100) -------------------------------------------------------------------------------- /Assignment10(SQL)/digikala_database.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FarzadForuozanfar/OS-LAB-Python-Cource/350286571c584157ba584e459223344861a7f267/Assignment10(SQL)/digikala_database.db -------------------------------------------------------------------------------- /Assignment2/README.md: -------------------------------------------------------------------------------- 1 | # Assignment 2 : 2 | ## Calculator : 3 | - [x] Add two numbers together (Press Num1) + 4 | - [x] Subtract two numbers from each other (Press Num2) - 5 | - [x] Multiply two numbers together (Press Num3) x 6 | - [x] Divided two number (Press Num4) / 7 | - [x] Sinus of an angle (press Num5) Sin 8 | - [x] Cosinus of an angle (Press Num6) Cos 9 | - [x] Tangent of an angle (Press Num7) Tan 10 | - [x] Cotangent of an angle (Press Num8) Cot 11 | - [x] Logarithm a number (Press Num9) log 12 | - [x] Exit and close programm (Press Num10) 13 | 14 | ## Palam,Polom,Plish Game✋🎮🤚 15 | - [x] Play With Two Cpu 16 | - [x] On Hand ✋ (Press Num1) 17 | - [x] Back Hand 🤚 (Press Num2) 18 | - [x] Play in 5 stages and announce the winner 🏆 19 | 20 | ## Rock✊,Paper✋,Scissors🤞,🎮Game🎮 21 | - [x] Play With CPU 22 | - [x] Rock✊ (Press Num1) 23 | - [x] Paper✋ (Press Num2) 24 | - [x] Scissors ✌️ (Press Num3) 25 | - [x] Play in 5 stages and announce the winner 🏆 26 | 27 | ## Seconds to Time : 28 | #### Convert seconds to time format (ex. 3661 sec == 1:01:01) 29 | 30 | ## Time To Second : 31 | #### Convert time to second format (ex. 1:01:01 sec == 3661) 32 | -------------------------------------------------------------------------------- /Assignment2/calculator.py: -------------------------------------------------------------------------------- 1 | import math 2 | while True: 3 | print("1- Add two number") 4 | print("2- Mines two number") 5 | print("3- Multiply two number") 6 | print("4- Divided two number") 7 | print("5- Sinus of an angle") 8 | print("6- Cosinus of an angle") 9 | print("7- Tangent of an angle") 10 | print("8- Cotangent of an angle") 11 | print("9- logarithm a number") 12 | print("10- exit program") 13 | Opration = input() 14 | if(Opration == '1'): 15 | print("Enter number 1 for calculate") 16 | number_1 = float(input()) 17 | print("Enter number 2 for calculate") 18 | number_2 = float(input()) 19 | print(number_1," + ",number_2," = ",number_2 + number_1) 20 | elif(Opration == '2'): 21 | print("Enter number 1 for calculate") 22 | number_1 = float(input()) 23 | print("Enter number 2 for calculate") 24 | number_2 = float(input()) 25 | print(number_1," - ",number_2," = ",number_1 - number_2) 26 | elif(Opration == '3'): 27 | print("Enter number 1 for calculate") 28 | number_1 = float(input()) 29 | print("Enter number 2 for calculate") 30 | number_2 = float(input()) 31 | print(number_1," x ",number_2," = ",number_2 * number_1) 32 | elif(Opration == '4'): 33 | print("Enter number 1 for calculate") 34 | number_1 = float(input()) 35 | print("Enter number 2 for calculate") 36 | number_2 = float(input()) 37 | print(number_1," / ",number_2," = ",number_1 / number_2) 38 | elif(Opration == '5'): 39 | print("Enter a Angle for calculat") 40 | angle = float(input()) 41 | degree = angle/360 *2 *math.pi 42 | result = math.sin(degree) 43 | print("sin ",angle," = ",result) 44 | elif(Opration == '6'): 45 | print("Enter a Angle for calculat") 46 | angle = float(input()) 47 | degree = angle/360 *2 *math.pi 48 | result = math.cos(degree) 49 | print("cos ",angle," = ",result) 50 | elif(Opration == '7'): 51 | print("Enter a Angle for calculat") 52 | angle = float(input()) 53 | degree = angle/360 *2 *math.pi 54 | result = math.tan(degree) 55 | print("tan ",angle," = ",result) 56 | elif(Opration == '8'): 57 | print("Enter a Angle for calculat") 58 | angle = float(input()) 59 | degree = angle/360 *2 *math.pi 60 | result = math.sin(degree) 61 | print("cot ",angle," = ",result) 62 | elif(Opration == '9'): 63 | print("Enter a number for calculat") 64 | number = float(input()) 65 | print("log (",number,") = ",math.log(number)) 66 | elif(Opration == '10'): 67 | break 68 | else: 69 | print("command not found") 70 | -------------------------------------------------------------------------------- /Assignment2/palam_polom_pilish.py: -------------------------------------------------------------------------------- 1 | import random 2 | from os import system 3 | user_wins = 0 4 | computer1_wins = 0 5 | computer2_wins = 0 6 | counter_ = 0 7 | round_ = 1 8 | print("Welcome To The ✋🎮🤚 Palam,Polom,Plish Game✋🎮🤚") 9 | while counter_ < 5: 10 | computer1_select = random.randint(1,2) 11 | computer2_select = random.randint(1,2) 12 | print("Choose Your Act") 13 | print("1- On Hand ✋") 14 | print("2- Back Hand🤚") 15 | user_select = int(input()) 16 | counter_ += 1 17 | if(user_select == 1 and computer2_select == 2 and computer1_select == 2 or user_select == 2 and computer2_select == 1 and computer1_select == 1): 18 | user_wins += 1 19 | print("!! You Win !! Round :",round_) 20 | print("user score :",user_wins) 21 | print("computer 1 score :",computer1_wins) 22 | print("computer 2 score :",computer2_wins) 23 | elif(user_select == 1 and computer2_select == 2 and computer1_select == 1 or user_select == 2 and computer2_select == 1 and computer1_select == 2): 24 | computer2_wins += 1 25 | print("!! computer 2 Win !! Round :",round_) 26 | print("user score :",user_wins) 27 | print("computer 1 score :",computer1_wins) 28 | print("computer 2 score :",computer2_wins) 29 | elif(user_select == 1 and computer2_select == 1 and computer1_select == 2 or user_select == 2 and computer2_select == 2 and computer1_select == 1): 30 | computer2_wins += 1 31 | print("!! computer 1 Win !! Round :",round_) 32 | print("user score :",user_wins) 33 | print("computer 1 score :",computer1_wins) 34 | print("computer 2 score :",computer2_wins) 35 | elif(user_select == computer1_select == computer2_select): 36 | print("!! match equalised !! Round!:",round_) 37 | print("user score :",user_wins) 38 | print("computer 1 score :",computer1_wins) 39 | print("computer 2 score :",computer2_wins) 40 | else: 41 | print("command not found") 42 | round_ -=1 43 | round_ += 1 44 | if(counter_ == 5): 45 | system('clear') 46 | if(user_wins > computer2_wins and user_wins > computer1_wins): 47 | print(" Congratulations ") 48 | print(" !! You Win This Game !! ") 49 | print("user score :",user_wins) 50 | print("computer 1 score :",computer1_wins) 51 | print("computer 2 score :",computer2_wins) 52 | break 53 | elif(user_wins < computer2_wins and computer2_wins > computer1_wins): 54 | print(" !! You Lost This Game !! ") 55 | print("Computer 2 Has Won Match") 56 | print("user score :",user_wins) 57 | print("computer 1 score :",computer1_wins) 58 | print("computer 2 score :",computer2_wins) 59 | break 60 | elif(user_wins < computer1_wins and computer2_wins < computer1_wins): 61 | print(" !! You Lost This Game !! ") 62 | print("Computer 1 Has Won Match") 63 | print("user score :",user_wins) 64 | print("computer 1 score :",computer1_wins) 65 | print("computer 2 score :",computer2_wins) 66 | break 67 | elif(user_wins == computer1_wins or user_wins == computer2_wins or computer2_wins == computer1_wins): 68 | print(" !! This Match is Equalised !!") 69 | print("user score :",user_wins) 70 | print("computer 1 score :",computer1_wins) 71 | print("computer 2 score :",computer2_wins) 72 | break 73 | break 74 | 75 | -------------------------------------------------------------------------------- /Assignment2/rock_paper_Scissors.py: -------------------------------------------------------------------------------- 1 | import random 2 | from typing import Counter 3 | user_wins = 0 4 | computer_wins = 0 5 | Counter = 0 6 | print("Welcome to the Rock✊,Paper✋,Scissors🤞,🎮Game🎮") 7 | while (Counter < 5 ) : 8 | 9 | computer_number = random.randint(1,3) 10 | 11 | print("press number for play") 12 | print("1- Rock✊") 13 | print("2- Paper✋") 14 | print("3- Scissors🤞") 15 | print("4- Exit Program") 16 | user_number = int(input()) 17 | Counter += 1 18 | #1= Rock 2=Paper 3-Scissor 19 | 20 | if(user_number == computer_number): 21 | print("To equalize") 22 | elif(user_number == 1 and computer_number == 3 or user_number == 2 and computer_number == 1 or user_number == 3 and computer_number == 2 and Counter < 5): 23 | user_wins +=1 24 | print("You win !!! AND Your score :",user_wins," AND Computer Score :",computer_wins) 25 | elif(user_number == 1 and computer_number == 2 or user_number == 2 and computer_number == 3 or user_number == 3 and computer_number == 1 and Counter < 5): 26 | computer_wins += 1 27 | print("You lose !!! AND Your score :",user_wins," AND Computer Score :",computer_wins) 28 | elif(user_number == 4): 29 | print("Game Over") 30 | break 31 | else: 32 | print("Your command not found plz try again") 33 | if(Counter == 5): 34 | if(user_wins > computer_wins): 35 | print("💪😍You Win This Game😍💪") 36 | print("Your Score :",user_wins) 37 | print("Computer Score :",computer_wins) 38 | elif(user_wins < computer_wins): 39 | print("❌😭You Lost This Game😭❌") 40 | print("Your Score :",user_wins) 41 | print("Computer Score :",computer_wins) 42 | elif(user_wins == computer_wins): 43 | print("The game equalised") 44 | print("Your Score :",user_wins) 45 | print("Computer Score :",computer_wins) 46 | print("🎌The Game Is Over🎌") 47 | break 48 | 49 | -------------------------------------------------------------------------------- /Assignment2/second to hour.py: -------------------------------------------------------------------------------- 1 | a=int(input("Enter the number in seconds :")) 2 | 3 | hour=a//3600 4 | 5 | b=a-3600*hour 6 | 7 | minute=b//60 8 | 9 | second=b-60*minute 10 | 11 | print(f"{hour}:{minute}:{second}") -------------------------------------------------------------------------------- /Assignment2/time to second.py: -------------------------------------------------------------------------------- 1 | time = input("Enter Your time like 10:36:10 :") 2 | 3 | hour, minute, second =time.split(":") 4 | 5 | sec=int(hour)*3600 + int(minute)*60+ int(second) 6 | 7 | print(sec) -------------------------------------------------------------------------------- /Assignment3/KMM && BMM.py: -------------------------------------------------------------------------------- 1 | 2 | num1 = int (input ("Enter firs number : ")) 3 | num2 = int (input ("Enter second number : ")) 4 | 5 | for i in range (1, num1 + 1): 6 | if i <= num2: 7 | if num1 % i == 0 and num2 % i == 0: 8 | BMM = i 9 | 10 | KMM = int((num1 * num2) / BMM) 11 | print("\nKMM is :",KMM,"\nBMM is:",BMM) -------------------------------------------------------------------------------- /Assignment3/README.md: -------------------------------------------------------------------------------- 1 | # Assignment 3 : 2 | ## KMM & BMM : 3 | Find the largest common divisor and the smallest common multiple between two integers 4 | 5 | ## HangMan : 6 | ![330px-Hangman svg](https://user-images.githubusercontent.com/91725214/155573188-aec5989c-ad0a-4753-b643-2e9d61f8e029.png) 7 | #### 8 | The word to guess is represented by a row of dashes, representing each letter of the word. Rules may permit or forbid proper nouns, such as names, places, brands, or slang. If the guessing player suggests a letter which occurs in the word, the other player writes it in all its correct positions. If the suggested letter does not occur in the word, the other player draws one element of a hanged stick figure as a tally mark. 9 | ## Is Armstrong Number : 10 | #### 11 | The Armstrong number is called a number. If we multiply each of its numbers by the power of the number of numbers, it becomes equal to the number itself. 12 | Example : 13 | Consider the number 153 14 | 153 is a three-digit number, so we multiply each of its numbers by the power of three and add it together: 15 | 153 = 1 * 1 * 1 + 5 * 5 * 5 + 3 * 3 * 3 16 | The number 153 is an Armstrong number. 17 | 18 | ## Is Factorial : 19 | #### 20 | Checks if it is a factorial number and returns a Boolean variable in response 21 | Example : 22 | Consider the number 120 = 1 * 2 * 3 * 4 * 5 = 5! 23 | 24 | ## Word Sentence : 25 | #### 26 | Counts the number of words in a sentence 27 | 28 | ## Random Array: 29 | #### 30 | Makes a random array with the size that the user gives as input 31 | ## Sort Array: 32 | #### 33 | Checks that the presentation received as input from the user is sorted descending 34 | -------------------------------------------------------------------------------- /Assignment3/hangman.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | word_bank = ["tree", "book", "python", "sadjad", "linux", "mac", "oslab", "windows", "java"] 4 | word = random.choice(word_bank) 5 | 6 | 7 | joon = len(word_bank+1) 8 | 9 | user_true_chars = [] 10 | 11 | while True: 12 | IS_WIN = True 13 | for char in word: 14 | if char in user_true_chars: 15 | print(char, end="") 16 | else: 17 | print("-", end="") 18 | IS_WIN = False 19 | 20 | if IS_WIN: 21 | print("\n\n You won the game.") 22 | break 23 | 24 | user_char = input("\nEnter a character: ") 25 | 26 | if user_char in word: 27 | print("✅") 28 | user_true_chars.append(user_char) 29 | else: 30 | joon -= 1 31 | print("❌") 32 | if joon == 0: 33 | print("\nGame over.") 34 | break -------------------------------------------------------------------------------- /Assignment3/is_armetrong.py: -------------------------------------------------------------------------------- 1 | print("Enter a number = ") 2 | number = input() 3 | n =int(number) 4 | count = 1 5 | sum = 0 6 | 7 | while n >= 10: #digits of a number 8 | n = n / 10 9 | count += 1 10 | 11 | 12 | for digit in number: 13 | sum += int(digit) ** count 14 | 15 | if(sum == int(number)): 16 | print("yes") 17 | else: 18 | print("no") -------------------------------------------------------------------------------- /Assignment3/is_factorial.py: -------------------------------------------------------------------------------- 1 | number = int(input('Enter your Number: ')) 2 | n = 0 3 | i = 0 4 | while n < number: 5 | i += 1 6 | n *= i 7 | if number == n: 8 | print('Yes') 9 | else: 10 | print('No') 11 | 12 | 13 | -------------------------------------------------------------------------------- /Assignment3/number_sentenc.py: -------------------------------------------------------------------------------- 1 | Sentence = input("Enter your Sentence: ") 2 | 3 | words = 0 4 | space = False 5 | for char in Sentence: 6 | if char==" ": 7 | if space==False: 8 | words += 1 9 | space = True 10 | else: 11 | space = False 12 | if(len(Sentence) == 0 or Sentence == space): 13 | print("There isnt any word in your sentence.") 14 | else: 15 | print("There is ",{words+1}," word in your sentence.") -------------------------------------------------------------------------------- /Assignment3/random_Array.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | import random 4 | 5 | array=[] 6 | print('enter size of array:') 7 | n=int(input()) 8 | for j in range(n): 9 | random_number=random.randint(0,100) 10 | if random_number not in array: 11 | array.append(random_number) 12 | 13 | print('Array =',array) -------------------------------------------------------------------------------- /Assignment3/sort_array.py: -------------------------------------------------------------------------------- 1 | from typing import Counter 2 | 3 | 4 | size_array = int(input("insert size of array :")) 5 | Counter = 0 6 | numbers = [] 7 | is_sort = True 8 | while Counter < size_array: 9 | x = int(input()) 10 | numbers.append(x) 11 | Counter += 1 12 | for i in range(len(numbers)): 13 | for j in range(len(numbers)): 14 | if numbers[i] > numbers[j]: 15 | is_sort = False 16 | if is_sort == True: 17 | print("yes its sort") 18 | 19 | else: 20 | print("no it isnt sort") 21 | -------------------------------------------------------------------------------- /Assignment4/Multiplication_table.py: -------------------------------------------------------------------------------- 1 | while True: 2 | n = int(input("Enter number for row :")) 3 | m = int(input("Enter number for column :")) 4 | if n > 0 and m > 0: 5 | break 6 | 7 | for i in range(1,n+1): 8 | for j in range(1,m+1): 9 | print("[",i,"x",j,"=",i*j,"]",end=" ") 10 | print() -------------------------------------------------------------------------------- /Assignment4/README.md: -------------------------------------------------------------------------------- 1 | # Assignment 4 : 2 | ### Multiplication_table : 3 | Create a multiplication table with the number of columns and rows desired by the user 4 | ### chesstable : 5 | Create a checkered page with the number of columns and rows desired by the user in the shape of a star and an hashtag # * 6 | ### fibo : 7 | Create a Fibonacci sequence to the user's liking using the repeat loop 8 | ### Tic Tac Toe 9 | 10 | Run in consol: 11 | #### 12 | ![image](https://user-images.githubusercontent.com/91725214/162984659-52db73ee-f68a-40ae-a411-8de84d8eae8e.png) 13 | -------------------------------------------------------------------------------- /Assignment4/chesstable.py: -------------------------------------------------------------------------------- 1 | while True: 2 | n = int(input("Enter number for row :")) 3 | m = int(input("Enter number for column :")) 4 | if n > 0 and m > 0: 5 | break 6 | for i in range(n): 7 | for j in range(m): 8 | if i % 2 == 0: 9 | if j % 2 == 0: 10 | print('#', end='') 11 | else: 12 | print('*', end='') 13 | else: 14 | if j % 2 == 0: 15 | print('*', end='') 16 | else: 17 | print('#', end='') 18 | print() 19 | 20 | -------------------------------------------------------------------------------- /Assignment4/fibo.py: -------------------------------------------------------------------------------- 1 | size = int(input('Enter a number for size of fibo: ')) 2 | 3 | fibo = [0, 1] 4 | if size == 1: 5 | print(fibo[0]) 6 | else: 7 | for i in range(2, size): 8 | fibo.append(fibo[i - 1] + fibo[i - 2]) 9 | print("fibo[",i,"]=",fibo[i]) -------------------------------------------------------------------------------- /Assignment4/photo_2021-10-22_19-30-52.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FarzadForuozanfar/OS-LAB-Python-Cource/350286571c584157ba584e459223344861a7f267/Assignment4/photo_2021-10-22_19-30-52.jpg -------------------------------------------------------------------------------- /Assignment4/tictaktoe.py: -------------------------------------------------------------------------------- 1 | from os import system 2 | from time import time 3 | import colorama 4 | from colorama import Fore 5 | import random 6 | 7 | game_board = [['_']*3, ['_']*3, ['_']*3] 8 | 9 | def Basic_game_table(): 10 | for i in range(3): 11 | for j in range(i): 12 | print('_ _ _') 13 | print() 14 | 15 | 16 | def is_tile_full(x, y): 17 | i = int(x) 18 | j = int(y) 19 | if game_board[i][j] != '_': 20 | return True 21 | else: 22 | return False 23 | 24 | def Identify_the_winner(): 25 | for i in range(3): 26 | digitX = 0 27 | digitO = 0 28 | for j in range(3): 29 | if game_board[i][j] == 'X': 30 | digitX +=1 31 | elif game_board[i][j] == 'O': 32 | digitO += 1 33 | if digitO == 3: 34 | return "second person" 35 | elif digitX == 3: 36 | return "first person" 37 | for i in range(3): 38 | digitX = 0 39 | digitO = 0 40 | for j in range(3): 41 | if game_board[j][i] == 'X': 42 | digitX += 1 43 | elif game_board[j][i] == 'O': 44 | digitO += 1 45 | if digitO == 3: 46 | return "second person" 47 | elif digitX == 3: 48 | return "first person" 49 | if game_board[0][0] == 'x' and game_board[1][1] == 'X' and game_board[2][2] == 'X' or game_board[0][2] == 'X' and game_board[1][1] == 'X' and game_board[2][0] == 'X': 50 | return "first person" 51 | elif game_board[0][0] == 'O' and game_board[1][1] == 'O' and game_board[2][2] == 'O' or game_board[0][2] == 'O' and game_board[1][1] == 'O' and game_board[2][0] == 'O': 52 | return "second person" 53 | 54 | def The_game_draw(): 55 | digit_blank = 0 56 | for i in range(3): 57 | for j in range(3): 58 | if game_board[i][j] == '_': 59 | digit_blank += 1 60 | if digit_blank == 0: 61 | return True 62 | else: 63 | return False 64 | 65 | def Show_game_board(): 66 | print() 67 | for i in range(3): 68 | for j in range(3): 69 | if game_board[i][j]=='X': 70 | print(Fore.YELLOW + 'X', end=' ') 71 | print(Fore.WHITE, end='') 72 | elif game_board[i][j]=='O': 73 | print(Fore.LIGHTMAGENTA_EX + 'O', end=' ') 74 | print(Fore.WHITE, end='') 75 | else: 76 | print('_', end=' ') 77 | print() 78 | 79 | 80 | #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Main ////////////////////////// 81 | 82 | 83 | print(" \n\n\\\\\\\\Welcome To Tic-Toc-Toe Game////\n\n") 84 | slct = int(input("1- Play With Computer\n\n2- Play With Player\n")) 85 | if slct == 1: 86 | t = time() 87 | Basic_game_table() 88 | while True: 89 | row = int(input("Enter a number for row =")) 90 | col = int(input("Enter a number for col =")) 91 | if 0 <= row-1 <= 2 and 0 <= col-1 <= 2: 92 | while is_tile_full(row-1, col-1): 93 | print("this tile is full plz ty again\n") 94 | row = int(input("Enter a number for row =")) 95 | col = int(input("Enter a number for col =")) 96 | 97 | game_board[row-1][col-1] = 'X' 98 | Show_game_board() 99 | 100 | if Identify_the_winner () == "first person": 101 | system ('clear') 102 | Show_game_board() 103 | print("🏆🏅Yeeeeeaaaah You won The Game🏅🏆") 104 | print(" Time :" ,round(time() - t, 2) , " seconds") 105 | exit() 106 | elif The_game_draw(): 107 | system ('clear') 108 | Show_game_board() 109 | print(" !!! The Game Is Draw !!! ") 110 | print(" Time :" ,round(time() - t, 2) , " seconds") 111 | exit() 112 | cm_row = random.randint(0,2) 113 | cm_col = random.randint(0,2) 114 | while is_tile_full(cm_row,cm_col): 115 | cm_row = random.randint(0,2) 116 | cm_col = random.randint(0,2) 117 | game_board[cm_row][cm_col] = 'O' 118 | Show_game_board() 119 | if Identify_the_winner () == "second person": 120 | system ('clear') 121 | Show_game_board() 122 | print("Computer Won The Game") 123 | print(" Time :" ,round(time() - t, 2) , " seconds") 124 | exit() 125 | elif The_game_draw(): 126 | system ('clear') 127 | Show_game_board() 128 | print(" !!! The Game Is Draw !!! ") 129 | print(" Time :" ,round(time() - t, 2) , " seconds") 130 | exit() 131 | else: 132 | print("choose correct number between 1 2 3") 133 | elif slct == 2: 134 | t1 = time() 135 | Basic_game_table() 136 | while True: 137 | row = int(input("Player 1 Enter a number for row =")) 138 | col = int(input("Player 1 Enter a number for col =")) 139 | if 0 <= row-1 <= 2 and 0 <= col-1 <= 2: 140 | while is_tile_full(row-1, col-1): 141 | print("this tile is full plz ty again\n") 142 | row = int(input("Player 1 Enter a number for row =")) 143 | col = int(input("Player 1 Enter a number for col =")) 144 | 145 | game_board[row-1][col-1] = 'X' 146 | Show_game_board() 147 | print(Identify_the_winner()) 148 | if Identify_the_winner () == "first person": 149 | system ('clear') 150 | Show_game_board() 151 | print("🏆🏅Player 1 won The Game🏅🏆") 152 | print(" Time :" ,round(time() - t1, 2) , " seconds") 153 | exit() 154 | elif The_game_draw(): 155 | system ('clear') 156 | Show_game_board() 157 | print(" !!! The Game Is Draw !!! ") 158 | print(" Time :" ,round(time() - t1, 2) , " seconds") 159 | exit() 160 | row = int(input("Player 2 Enter a number for row =")) 161 | col = int(input("Player 2 Enter a number for col =")) 162 | if 0 <= row-1 <= 2 and 0 <= col-1 <= 2: 163 | while is_tile_full(row-1, col-1): 164 | print("this tile is full plz ty again\n") 165 | row = int(input("Player 2 Enter a number for row =")) 166 | col = int(input("Player 2 Enter a number for col =")) 167 | 168 | game_board[row-1][col-1] = 'O' 169 | Show_game_board() 170 | 171 | if Identify_the_winner () == "second person": 172 | system ('clear') 173 | Show_game_board() 174 | print("🏆🏅Player 2 won The Game🏅🏆") 175 | print(" Time :" ,round(time() - t1, 2) , " seconds") 176 | exit() 177 | elif The_game_draw(): 178 | system ('clear') 179 | Show_game_board() 180 | print(" !!! The Game Is Draw !!! ") 181 | print(" Time :" ,round(time() - t1, 2) , " seconds") 182 | exit() 183 | -------------------------------------------------------------------------------- /Assignment5/README.md: -------------------------------------------------------------------------------- 1 | # Assignment 5(Store) : 2 | Build a store software based on the CSV database with limited features such as 3 | - [x] Adding new items to the store 4 | - [x] Edit items 5 | - [x] Delete items 6 | - [x] Show items list 7 | - [x] Search items 8 | - [x] Buy items 9 | - [x] Exit 10 | 11 | Each items have : 12 | - Id(bar-code) 13 | - Name 14 | - Price 15 | - Count 16 | -------------------------------------------------------------------------------- /Assignment5/database.csv: -------------------------------------------------------------------------------- 1 | 1000,cake,5000,30 2 | 1001,milk,12000,50 3 | 1002,chips,6000,37 4 | 1003,pofack,8000,41 5 | 1004,cookies,2500,49 6 | 1005,chokolate,1000,178 -------------------------------------------------------------------------------- /Assignment5/database.txt: -------------------------------------------------------------------------------- 1 | 1000,cake,5000,30 2 | 1001,milk,12000,50 3 | 1002,chips,6000,37 4 | 1003,pofack,8000,41 5 | 1004,cookies,2500,49 6 | 1005,chokolate,1000,178 -------------------------------------------------------------------------------- /Assignment5/store.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | Prodacts =[] 4 | 5 | def read_from_database(): 6 | f = open('database.txt', 'r') 7 | text = f.read() 8 | rows = text.split("\n") 9 | for row in rows: 10 | info = row.split(",") 11 | new_dict = {'code':info[0], 'name':info[1], 'price':info[2], 'count':info[3]} 12 | Prodacts.append(new_dict) 13 | 14 | 15 | def show_list(): 16 | os.system("clear") 17 | read_from_database() 18 | for prodact in Prodacts: 19 | print([prodact]) 20 | 21 | def add(): 22 | os.system("clear") 23 | code = input("Enter code for new product: ") 24 | name = input("Enter name for new product: ") 25 | price = input("Enter price for new product: ") 26 | count = input("Enter count for new product: ") 27 | Prodacts.append({"code":code,"name":name,"price":price,"count":count}) 28 | 29 | def delete(): 30 | temp_name = input("Enter the name of the product you want to delete: ") 31 | for prodact in Prodacts: 32 | if prodact["name"] == temp_name: 33 | Prodacts.remove[prodact] 34 | print("The product was deleted") 35 | break 36 | else: 37 | print("product not found") 38 | return 39 | 40 | def edit(): 41 | name = input("Enter the name of the product you want to edit: ") 42 | for prodact in Prodacts: 43 | if name == Prodacts[prodact]: 44 | new_name = input("enter new name for product: ") 45 | Prodacts[prodact]['name'] = new_name 46 | new_code = input("enter new code for product: ") 47 | Prodacts[prodact]['code'] = new_code 48 | new_price = input("enter new price for product: ") 49 | Prodacts[prodact]['price'] = new_price 50 | new_count = input("enter new count for product: ") 51 | Prodacts[prodact]['count'] = new_count 52 | 53 | else: 54 | print("product not found") 55 | 56 | def search(): 57 | search_name = input("Enter the name of the product you want to search: ") 58 | for product in Prodacts: 59 | if Prodacts[product]['name'] == search_name: 60 | print("this product is exist in store") 61 | print(Prodacts[product]["name"],Prodacts[product]["code",Prodacts[product]["price"],Prodacts[product]["count"]]) 62 | return 63 | else: 64 | print("product not found in list") 65 | 66 | def buy(): 67 | product_name =[] 68 | shoping_list = [] 69 | cost_list_shop = [] 70 | for product in Prodacts: 71 | product_name.append(Prodacts[product]['name']) 72 | flag = True 73 | while flag: 74 | x = 1 75 | print("enter the product name you are looking for ((for example:milk)) :") 76 | for i in product_name: 77 | print(x,"- ",product_name[i],"\n") 78 | x += 1 79 | print(x,"- Exit the shopping list and transfer to the payment page") 80 | select = input() 81 | if select == 'Exit' or 'exit': 82 | break 83 | else: 84 | digit_product_shop = input("Enter number of",product_name[i]) 85 | cost_list_shop.append(digit_product_shop * product_name[i]['price']) 86 | total_cost = 0 87 | for i in cost_list_shop: 88 | total_cost += cost_list_shop[i] 89 | print("Total cost for paid is: ",total_cost) 90 | 91 | 92 | def save(): 93 | f = open('database.txt', 'r') 94 | text = f.write(Prodacts) 95 | 96 | def show_menu(): 97 | print("""1- Add 98 | 2- Edit 99 | 3- Delete 100 | 4- Show List 101 | 5- Search 102 | 6- Buy 103 | 7- Exit""") 104 | 105 | # \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MAIN ////////////////////////////# 106 | while True: 107 | show_menu() 108 | choose = input("select your choice :") 109 | if choose == 1: 110 | add() 111 | elif choose == 2: 112 | edit() 113 | elif choose == 3: 114 | delete() 115 | elif choose == 4: 116 | show_list() 117 | elif choose == 5: 118 | search() 119 | elif choose == 6: 120 | buy() 121 | elif choose == 7: 122 | save() 123 | exit() 124 | 125 | -------------------------------------------------------------------------------- /Assignment6/README.md: -------------------------------------------------------------------------------- 1 | # Assignment 6 (Translator): 2 | Creating a dictionary by a words bank in which all data (words) are stored : 3 | - [x] Persian to English 4 | - [x] English to Persian 5 | -------------------------------------------------------------------------------- /Assignment6/translate.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | WORDS_BANK = [] 4 | 5 | def Load_data(): 6 | with open("words_bank.txt" , 'r') as f: 7 | big_text = f.read() 8 | words = big_text.split('\n') 9 | 10 | for i in range(0, len(words), 2) : 11 | WORDS_BANK.append({'english' : words[i] , 'persian' : words[i+1]}) 12 | 13 | def Translate_english_To_farsi(input_text): 14 | input_text= input("please insert your english sentence for translate to farsi :") 15 | user_words= input_text.split(' ') 16 | output_text= '' 17 | for user_word in user_words: 18 | for word in WORDS_BANK: 19 | if user_word == word['english']: 20 | output_text += word['persian'] + ' ' 21 | break 22 | else: 23 | output_text += user_word + ' ' 24 | 25 | print(output_text) 26 | 27 | def Translate_farsi_To_english(input_text): 28 | input_text= input("please insert your english sentence for translate to farsi :") 29 | user_words= input_text.split(' ') 30 | output_text= '' 31 | for user_word in user_words: 32 | for word in WORDS_BANK: 33 | if user_word == word['persian']: 34 | output_text += word['english'] + ' ' 35 | break 36 | else: 37 | output_text += user_word + ' ' 38 | 39 | print(output_text) 40 | 41 | def Add_new_word(): 42 | english_word = input("please insert English word :") 43 | farsi_word = input("please insert Farsi word :") 44 | duplicate_word = False 45 | while not duplicate_word: 46 | for word in WORDS_BANK: 47 | if english_word == word["english"]: 48 | os.system("clear") 49 | print("!! This word is duplicate and can not be stored in the word bank !!") 50 | english_word = input("please insert English word :") 51 | farsi_word = input("please insert Farsi word :") 52 | break 53 | else: 54 | duplicate_word = True 55 | WORDS_BANK.append({'english' : english_word , 'persian' : farsi_word}) 56 | print("Your word was successfully saved in the word bank") 57 | 58 | def show_menu(): 59 | print("""1- add new word 60 | 2- translation english2persian 61 | 3- translation persian2english 62 | 4- Exit and save""") 63 | 64 | def save_data(): 65 | f = open('words_bank.txt', 'w') 66 | f.write(WORDS_BANK) 67 | 68 | def main_func(): 69 | 70 | while(True): 71 | show_menu() 72 | select = int(input("please choice a number from menu :")) 73 | if select == 1: 74 | Add_new_word() 75 | elif select == 2: 76 | Translate_english_To_farsi 77 | elif select == 3: 78 | Translate_farsi_To_english 79 | elif select == 4: 80 | save_data() 81 | exit() 82 | else: 83 | print("!! please insert correct number !!") 84 | #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ {MAIN-FUNC} ////////////////////////////////////////////////// 85 | 86 | Load_data() 87 | main_func() -------------------------------------------------------------------------------- /Assignment6/words_bank.txt: -------------------------------------------------------------------------------- 1 | this 2 | in 3 | is 4 | hast 5 | simple 6 | sade 7 | text 8 | matn 9 | book 10 | ketab 11 | love 12 | doost dashtan 13 | from 14 | az 15 | language 16 | zaban 17 | they 18 | anha 19 | i 20 | man 21 | a 22 | yek 23 | you 24 | shoma 25 | apple 26 | sib 27 | teacher 28 | moalem 29 | class 30 | kelas 31 | mark 32 | nomre 33 | we 34 | ma 35 | computer 36 | rayane 37 | engineer 38 | mohandes 39 | am 40 | hastam 41 | was 42 | bood 43 | programmer 44 | barname nevis 45 | place 46 | makan 47 | what 48 | chi 49 | university 50 | daneshgah 51 | in 52 | dar 53 | go 54 | raftan 55 | sleep 56 | khabidan 57 | were 58 | bodand 59 | he 60 | oo 61 | i.r.iran 62 | jomhooriye eslamiye iran 63 | she 64 | oo 65 | mother 66 | madar 67 | friend 68 | doost 69 | father 70 | pedar 71 | program 72 | barname 73 | hi 74 | salam 75 | hello 76 | salam 77 | word 78 | kalame 79 | god 80 | khoda 81 | school 82 | madrese 83 | clear 84 | tamiz 85 | it 86 | in 87 | team 88 | goroh 89 | tell 90 | goftan 91 | letter 92 | nameh 93 | thank 94 | mamnoon 95 | boy 96 | pesar 97 | girl 98 | dokhtar 99 | farmer 100 | keshavarz 101 | doctor 102 | pezeshk 103 | world 104 | jahan 105 | are 106 | hast 107 | program 108 | barname 109 | new 110 | jadid 111 | mr 112 | aghaye 113 | compute 114 | pardazesh 115 | come 116 | amadan 117 | note 118 | yaddasht 119 | library 120 | ketabkhane 121 | mousqe 122 | masjed 123 | put 124 | gozashtan 125 | theme 126 | poste 127 | celever 128 | bahosh 129 | home 130 | khane 131 | live 132 | zendegi 133 | camera 134 | dorbim 135 | picture 136 | tasvir 137 | use 138 | estefade 139 | good 140 | khob 141 | can 142 | tavanestan 143 | write 144 | neveshtan 145 | problem 146 | moshkel 147 | machine 148 | mashin 149 | result 150 | natije 151 | year 152 | sal 153 | fast 154 | sari 155 | slow 156 | kond 157 | one 158 | yek 159 | two 160 | do 161 | three 162 | se 163 | four 164 | char 165 | five 166 | panj 167 | six 168 | shesh 169 | seven 170 | haft 171 | eight 172 | hasht 173 | ten 174 | dah 175 | job 176 | kar 177 | data 178 | dadeh 179 | network 180 | shabake 181 | could 182 | tavanest 183 | car 184 | mashin 185 | very 186 | besiyar 187 | way 188 | rah 189 | people 190 | mardom 191 | hand 192 | dast 193 | day 194 | rooz 195 | night 196 | shab 197 | all 198 | hame 199 | earth 200 | zamin 201 | down 202 | payin 203 | best 204 | behtarin 205 | for 206 | baraye 207 | hi 208 | salam 209 | apple 210 | sib 211 | dark 212 | tarik 213 | -------------------------------------------------------------------------------- /Assignment7/Khayam-Pascal.py: -------------------------------------------------------------------------------- 1 | def khayampascal(n): 2 | array=[] 3 | end = n 4 | for n in range(0,n): 5 | array.append([]) 6 | if n==0: 7 | array[n].append(1) 8 | elif n==1: 9 | array[n].append(1) 10 | array[n].append(1) 11 | elif n>=2 and n output : 01:00:00) 28 | - [x] divide two fraction numbers (E.X input : 01:00:00 ==> output : 3600 seconds) 29 | - [x] exit 30 | -------------------------------------------------------------------------------- /Assignment8/complex_numbers.py: -------------------------------------------------------------------------------- 1 | from os import system 2 | array = [] 3 | def input_data(): 4 | a = int(input("insert real part :")) 5 | b = int(input("insert imaginary part :")) 6 | return array[a,b] 7 | 8 | def Show_menu(): 9 | print(""" 10 | ______________________________ 11 | | | 12 | | 1- + Add + | 13 | | 2- - Mines - | 14 | | 3- x Multiply x | 15 | | 4- Exit | 16 | |____________________________|""") 17 | 18 | class Complex_numbers: 19 | def __init__(self, x = 0, y = 0): 20 | self.a = x 21 | self.b = y 22 | 23 | def Add(self, other): 24 | result = Complex_numbers(self.a + other.a,self.b + other.b) 25 | result.show_complx() 26 | return result 27 | 28 | def Mines(self, other): 29 | result = Complex_numbers(self.a - other.a,self.b - other.b) 30 | result.show_complx() 31 | return result 32 | 33 | def Multi(self, other): 34 | result = Complex_numbers() 35 | if self.a == 0 and other.a != 0: 36 | result.a = other.a 37 | elif self.a != 0 and other.a == 0: 38 | result.a = self.a 39 | elif self.a == 0 and other.a == 0: 40 | result.a = 0 41 | else: 42 | result.a = self.a * other.a 43 | 44 | if self.b == 0 and other.b != 0: 45 | result.b = other.b 46 | elif self.b != 0 and other.b == 0: 47 | result.b = self.b 48 | elif self.b == 0 and other.b == 0: 49 | result.b = 0 50 | else: 51 | result.b = self.b * other.b 52 | result.show_complx() 53 | return result 54 | def show_complx(self): 55 | print(self.a ,"+",self.b,"i") 56 | #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MAIn ///////////////////// 57 | while True: 58 | Show_menu() 59 | choice = int(input("insert a number from menu :")) 60 | if choice == 1: 61 | system("cls") 62 | print("Data for first complex number") 63 | input_data() 64 | c1 = Complex_numbers(array[0],array[1]) 65 | array.clear() 66 | print("Data for first complex number") 67 | input_data() 68 | c2 = Complex_numbers(array[0],array[1]) 69 | array.clear() 70 | result = Complex_numbers.Add(c1,c2) 71 | elif choice ==2: 72 | system("cls") 73 | print("Data for first complex number") 74 | input_data() 75 | c1 = Complex_numbers(array[0],array[1]) 76 | array.clear() 77 | print("Data for first complex number") 78 | input_data() 79 | c2 = Complex_numbers(array[0],array[1]) 80 | array.clear() 81 | result = Complex_numbers.Mines(c1,c2) 82 | elif choice == 3: 83 | system("cls") 84 | print("Data for first complex number") 85 | input_data() 86 | c1 = Complex_numbers(array[0],array[1]) 87 | array.clear() 88 | print("Data for first complex number") 89 | input_data() 90 | c2 = Complex_numbers(array[0],array[1]) 91 | array.clear() 92 | result = Complex_numbers.Multi(c1,c2) 93 | elif choice == 4: 94 | exit() 95 | else: 96 | print("!! command not found !!") 97 | 98 | -------------------------------------------------------------------------------- /Assignment8/faraction.py: -------------------------------------------------------------------------------- 1 | 2 | from os import system 3 | list_num = [] 4 | def lcm(num1 , num2): 5 | a = num1 6 | b = num2 7 | if a < b: 8 | temp = a 9 | a = b 10 | b = temp 11 | while b != 0: 12 | r = a % b 13 | a = b 14 | b = r 15 | return int((num1 * num2) / a) 16 | def input_date(): 17 | num1 = int(input("Plz Enter numerator :")) 18 | num2 = int(input("Plz Enter denominator :")) 19 | while num2 == 0: 20 | print("!! The denominator of the fraction cannot be entered as zero !!") 21 | num2 = int(input("!!Try Again!! Enter denominator :")) 22 | list_num.append(num1) 23 | list_num.append(num2) 24 | return list_num 25 | def Show_menu(): 26 | print(""" 27 | ______________________________ 28 | | | 29 | | 1- + ADD Fraction + | 30 | | 2- - Mines Fraction - | 31 | | 3- x Multiply x | 32 | | 4- / Division / | 33 | | 5- EXIT | 34 | |____________________________|""") 35 | class Fraction_Math: 36 | def __init__(self, num, denom): 37 | self.numerator = num 38 | self.denominator = denom 39 | def Add(self, other): 40 | denom_result = lcm(self.denominator, other.denominator) 41 | print(int(denom_result / other.denominator),int(denom_result / self.denominator)) 42 | result = (self.numerator * int(denom_result / self.denominator) + other.numerator * int(denom_result / other.denominator), denom_result) 43 | return result 44 | def Sub(self, other): 45 | denom_result = lcm(self.denominator, other.denominator) 46 | result = (self.numerator * int(denom_result / self.denominator) + other.numerator * int(denom_result / other.denominator), denom_result) 47 | return result 48 | def Mul(self, other): 49 | return self.numerator*other.numerator, self.denominator*other.denominator 50 | def Div(self, other): 51 | return self.numerator*other.denominator, self.denominator*other.numerator 52 | def Show_Fraction_Math(self): 53 | return '%s/%s' %(self.numerator, self.denominator) 54 | def __str__(self): 55 | if type(self) is tuple: 56 | if self[1] < 0: 57 | return '%s/%s' %(self[0], -1*self[1]) 58 | else: 59 | return '%s/%s' %(self[0], self[1]) 60 | elif self.denominator == 1: 61 | return str(self.numerator) 62 | else: 63 | return '%s/%s' %(self.numerator, self.denominator) 64 | #///////////////////////////////////////////////// MAIN \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 65 | #while True: 66 | while True: 67 | 68 | Show_menu() 69 | SELECT = int(input("Select your choice: ")) 70 | if SELECT == 1: 71 | system('clear') 72 | print(" Data of first Fraction ") 73 | input_date() 74 | FRC1 = Fraction_Math(list_num[0],list_num[1]) 75 | list_num.clear() 76 | print(" Data of second Fraction ") 77 | input_date() 78 | FRC2 = Fraction_Math(list_num[0],list_num[1]) 79 | list_num.clear() 80 | Result = Fraction_Math.Add(FRC1,FRC2) 81 | print(Fraction_Math.__str__(FRC1), " + ", Fraction_Math.__str__(FRC2)," = ",Fraction_Math.__str__(Result)) 82 | elif SELECT == 2: 83 | system('clear') 84 | print(" Data of first Fraction ") 85 | input_date() 86 | FRC1 = Fraction_Math(list_num[0],list_num[1]) 87 | list_num.clear() 88 | print(" Data of second Fraction ") 89 | input_date() 90 | FRC2 = Fraction_Math(list_num[0],list_num[1]) 91 | list_num.clear() 92 | Result = Fraction_Math.Add(FRC1,FRC2) 93 | print(Fraction_Math.__str__(FRC1), " - ", Fraction_Math.__str__(FRC2)," = ",Fraction_Math.__str__(Result)) 94 | elif SELECT == 3: 95 | system('clear') 96 | print(" Data of first Fraction ") 97 | input_date() 98 | FRC1 = Fraction_Math(list_num[0],list_num[1]) 99 | list_num.clear() 100 | print(" Data of second Fraction ") 101 | input_date() 102 | FRC2 = Fraction_Math(list_num[0],list_num[1]) 103 | list_num.clear() 104 | Result = Fraction_Math.Add(FRC1,FRC2) 105 | print(Fraction_Math.__str__(FRC1), " X ", Fraction_Math.__str__(FRC2)," = ",Fraction_Math.__str__(Result)) 106 | elif SELECT == 4: 107 | system("clear") 108 | print(" Data of first Fraction ") 109 | input_date() 110 | FRC1 = Fraction_Math(list_num[0],list_num[1]) 111 | list_num.clear() 112 | print(" Data of second Fraction ") 113 | input_date() 114 | FRC2 = Fraction_Math(list_num[0],list_num[1]) 115 | list_num.clear() 116 | Result = Fraction_Math.Add(FRC1,FRC2) 117 | print(Fraction_Math.__str__(FRC1), " / ", Fraction_Math.__str__(FRC2)," = ",Fraction_Math.__str__(Result)) 118 | elif SELECT == 5: 119 | exit() 120 | break -------------------------------------------------------------------------------- /Assignment8/time.py: -------------------------------------------------------------------------------- 1 | 2 | from _typeshed import Self 3 | from os import system 4 | time = [] 5 | 6 | def input_data(): 7 | h = int(input("hour =")) 8 | if 0 <= h <= 23: 9 | time.append(h) 10 | else: 11 | time.append(0) 12 | m = int(input("minute :")) 13 | if 0 <= m < 60: 14 | time.append(m) 15 | else: 16 | time.append(0) 17 | s = int(input("second :")) 18 | if 0 <= s < 60: 19 | time.append(s) 20 | return time 21 | 22 | def Show_menu(): 23 | print(""" 24 | ______________________________ 25 | | | 26 | | 1- ADD two time | 27 | | 2- Mines tow time | 28 | | 3- time to second | 29 | | 4- second to time | 30 | | 5- EXIT | 31 | |____________________________|""") 32 | 33 | def Second_to_time(input_second): 34 | result = Time() 35 | result.hour=input_second//3600 36 | temp=input_second-3600*result.hour 37 | result.miniute=temp//60 38 | result.second=temp-60*result.miniute 39 | return result 40 | 41 | class Time: 42 | 43 | def __init__(self, s = 0, m = 0, h = 0, d =0): 44 | self.second = s 45 | self.miniute = m 46 | self.hour = h 47 | self.day = d 48 | 49 | def Show_time(): 50 | if Self.day == 0: 51 | print(Self.hour," : ",Self.miniute," : ",Self.second) 52 | else: 53 | print("Day = ",Self.day,"\n",Self.hour," : ", Self.miniute, " : ",Self.second) 54 | 55 | def Which_is_bigger(self, other): 56 | if self.hour > other.hour: 57 | return self 58 | elif self.hour < other.hour: 59 | return other 60 | elif self.miniute > other.miniute: 61 | return self 62 | elif self.miniute < other.miniute: 63 | return other 64 | elif self.second > other.second: 65 | return self 66 | elif self.second < other.second: 67 | return other 68 | elif self.hour == other.hour and self.miniute == other.miniute and self.second == other.second: 69 | return Time() 70 | def Add_times(self, other): 71 | result = Time() 72 | second_result = self.second + other.second 73 | miniute_result = self.miniute + other.miniute 74 | hour_result = self.hour + other.hour 75 | while second_result >= 60: 76 | second_result -= 60 77 | miniute_result += 1 78 | while miniute_result >= 60: 79 | miniute_result -= 60 80 | hour_result += 1 81 | while hour_result >= 24: 82 | hour_result -= 24 83 | self.day += 1 84 | result(second_result, miniute_result, hour_result, result.day) 85 | result.Show_time() 86 | return result 87 | 88 | def Mines_times(self,other): 89 | result = Time() 90 | if self.Which_is_bigger() == self: 91 | if self.second < other.second: 92 | if self.miniute == 0: 93 | self.hour -= 1 94 | self.miniute += 59 95 | self.second += 60 96 | else: 97 | self.miniute -=1 98 | self.second += 60 99 | 100 | second_result = self.second - other.second 101 | if self.miniute < other.miniute: 102 | self.hour -= 1 103 | self.miniute += 60 104 | miniute_result = self.miniute - other.miniute 105 | hour_result = self.hour - other.hour 106 | 107 | elif self.Which_is_bigger() == other: 108 | if self.second > other.second: 109 | if other.miniute == 0: 110 | other.hour -= 1 111 | other.miniute += 59 112 | other.second += 60 113 | else: 114 | other.miniute -=1 115 | other.second += 60 116 | second_result = other.second - self.second 117 | miniute_result = other.miniute - self.miniute 118 | hour_result = other.hour - self.hour 119 | else: 120 | result = Time(0,0,0,0) 121 | result.Show_time() 122 | return result 123 | result(second_result, miniute_result, hour_result, result.day) 124 | result.Show_time() 125 | return result 126 | 127 | def Time_to_second(self): 128 | sec=int(self.hour)*3600 + int(self.miniute)*60+ int(self.second) 129 | print("Time convert to second = ",sec) 130 | #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Main /////////////////////////////////////# 131 | while True: 132 | Show_menu() 133 | choice = int(input("\ninsert a number from menu :")) 134 | if choice == 1: 135 | system("cls") 136 | print("Data for first TIME object") 137 | input_data() 138 | time1 = Time(time(0),time(1),time(2),0) 139 | time.clear() 140 | print("Data for second TIME object") 141 | input_data() 142 | time2 = Time(time(0),time(1),time(2),0) 143 | time.clear() 144 | result = Time.Add_times(time1,time2) 145 | elif choice == 2: 146 | system("cls") 147 | print("Data for first TIME object") 148 | input_data() 149 | time1 = Time(time(0),time(1),time(2),0) 150 | time.clear() 151 | print("Data for second TIME object") 152 | input_data() 153 | time2 = Time(time(0),time(1),time(2),0) 154 | time.clear() 155 | result = Time.Add_times(time1,time2) 156 | elif choice == 3: 157 | system("cls") 158 | print("Data for TIME object") 159 | input_data() 160 | time_object = Time(time(0),time(1),time(2),0) 161 | time.clear() 162 | time_object.Time_to_second() 163 | elif choice == 4: 164 | system("cls") 165 | sec = int(input("Enter second for convert to time :")) 166 | time_object = Second_to_time(sec) 167 | time_object.Show_time() 168 | elif choice == 5: 169 | exit() 170 | else: 171 | print("!! command not found !! ") 172 | -------------------------------------------------------------------------------- /Assignment9/README.md: -------------------------------------------------------------------------------- 1 | # oslab_Ass14 2 | for use Trigonometric_calculations : 3 | ###### you must at the first write degree then select your Trigonometric_calculations 4 | -------------------------------------------------------------------------------- /Assignment9/calculator.py: -------------------------------------------------------------------------------- 1 | from math import * 2 | from PySide6.QtWidgets import * 3 | from PySide6.QtGui import * 4 | from PySide6.QtCore import * 5 | from PySide6.QtUiTools import QUiLoader 6 | from functools import partial 7 | class Calculator(QMainWindow): 8 | def __init__(self): 9 | super().__init__() 10 | loader = QUiLoader() 11 | self .ui = loader.load("design.ui") 12 | self.ui.show() 13 | self.temp_num = 0 14 | self.result = 0 15 | self.current_op = '' #آخرین عملگر ریاضی را در خود ذخیره می کند تا در زمان استفاده از مساوی بداند باید چه عملی انجام دهد 16 | ##################### Operations ######################## 17 | self.ui.btn_sum.clicked.connect(partial(self.The_four_basic_mathematical_operations,'+')) 18 | self.ui.btn_mines.clicked.connect(partial(self.The_four_basic_mathematical_operations,'-')) 19 | self.ui.btn_div.clicked.connect(partial(self.The_four_basic_mathematical_operations,'/')) 20 | self.ui.btn_multi.clicked.connect(partial(self.The_four_basic_mathematical_operations,'*')) 21 | self.ui.btn_sin.clicked.connect(partial(self.Trigonometric_calculations,'sin')) 22 | self.ui.btn_cos.clicked.connect(partial(self.Trigonometric_calculations,'cos')) 23 | self.ui.btn_tan.clicked.connect(partial(self.Trigonometric_calculations,'tan')) 24 | self.ui.btn_cot.clicked.connect(partial(self.Trigonometric_calculations,'cot')) 25 | self.ui.btn_eqaul.clicked.connect(self.Eqaul) 26 | self.ui.btn_log.clicked.connect(self.Logarithm) 27 | self.ui.btn_sqrt.clicked.connect(self.Sqrt) 28 | self.ui.btn_percent.clicked.connect(self.Percent) 29 | self.ui.btn_clear.clicked.connect(self.Clear_text_box) 30 | ##################### Number btn ######################### 31 | self.ui.btn_0.clicked.connect(partial(self.Write_number_in_text_box,0)) 32 | self.ui.btn_1.clicked.connect(partial(self.Write_number_in_text_box,1)) 33 | self.ui.btn_2.clicked.connect(partial(self.Write_number_in_text_box,2)) 34 | self.ui.btn_3.clicked.connect(partial(self.Write_number_in_text_box,3)) 35 | self.ui.btn_4.clicked.connect(partial(self.Write_number_in_text_box,4)) 36 | self.ui.btn_5.clicked.connect(partial(self.Write_number_in_text_box,5)) 37 | self.ui.btn_6.clicked.connect(partial(self.Write_number_in_text_box,6)) 38 | self.ui.btn_7.clicked.connect(partial(self.Write_number_in_text_box,7)) 39 | self.ui.btn_8.clicked.connect(partial(self.Write_number_in_text_box,8)) 40 | self.ui.btn_9.clicked.connect(partial(self.Write_number_in_text_box,9)) 41 | self.ui.btn_decimal.clicked.connect(partial(self.Write_number_in_text_box,'.')) 42 | ##################################################################### 43 | def Write_number_in_text_box(self,number): 44 | self.ui.lineEdit.setText(self.ui.lineEdit.text() + str(number)) 45 | 46 | def The_four_basic_mathematical_operations(self,operation): 47 | try: 48 | if operation == '+': 49 | self.current_op = '+' 50 | self.result += float(self.ui.lineEdit.text()) 51 | elif operation == '-': 52 | self.result += float(self.ui.lineEdit.text()) 53 | self.current_op = '-' 54 | elif operation == '*': 55 | self.result *= float(self.ui.lineEdit.text()) 56 | self.current_op = '*' 57 | elif operation == '/': 58 | self.result /= float(self.ui.lineEdit.text()) 59 | self.current_op = '/' 60 | self.ui.lineEdit.setText("") 61 | except: 62 | self.ui.lineEdit.setText("!! خطا !!") 63 | self.result = 0 64 | 65 | def Trigonometric_calculations(self,operation): 66 | try: 67 | if operation == 'sin': 68 | self.result = float(self.ui.lineEdit.text()) 69 | self.ui.lineEdit.setText(str(sin(radians(self.result)))) 70 | self.box_is_empty = False 71 | elif operation == 'cos': 72 | self.result = float(self.ui.lineEdit.text()) 73 | self.ui.lineEdit.setText(str(cos(radians(self.result)))) 74 | elif operation == 'tan': 75 | self.result = float(self.ui.lineEdit.text()) 76 | self.ui.lineEdit.setText(str(tan(radians(self.result)))) 77 | elif operation == 'cot': 78 | self.result = float(self.ui.lineEdit.text()) 79 | self.result = 1 / tan(radians(self.result)) 80 | self.ui.lineEdit.setText(str(self.result)) 81 | except: 82 | self.ui.lineEdit.setText("!! خطا !!") 83 | self.result = 0 84 | 85 | def Logarithm(self): 86 | self.ui.lineEdit.setText(str(log10(float(self.ui.lineEdit.text())))) 87 | 88 | def Percent(self): 89 | self.result = float(self.ui.lineEdit.text()) 90 | self.result /= 100 91 | self.ui.lineEdit.setText(str(self.result)) 92 | 93 | def Sqrt(self): 94 | self.ui.lineEdit.setText(str(sqrt(float(self.ui.lineEdit.text())))) 95 | 96 | def Clear_text_box(self): 97 | self.result = 0 98 | self.current_op = None 99 | self.temp_num = None 100 | self.ui.lineEdit.setText("") 101 | 102 | def Eqaul(self): 103 | self.temp_num = float(self.ui.lineEdit.text()) 104 | if self.current_op == '+': 105 | self.ui.lineEdit.setText(str(self.result + self.temp_num)) 106 | elif self.current_op == "-": 107 | self.ui.lineEdit.setText(str(self.result - self.temp_num)) 108 | elif self.current_op == "*": 109 | self.ui.lineEdit.setText(str(self.result * self.temp_num)) 110 | elif self.current_op == "/": 111 | self.ui.lineEdit.setText(str(self.result / self.temp_num)) 112 | self.result = 0 113 | self.current_op = "" 114 | self.temp_num = 0 115 | app = QApplication() 116 | cal = Calculator() 117 | app.exec() 118 | -------------------------------------------------------------------------------- /Assignment9/design.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 272 10 | 258 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | Qt::RightToLeft 18 | 19 | 20 | 21 | 22 | 23 | 0 24 | 0 25 | 271 26 | 61 27 | 28 | 29 | 30 | 31 | background-color: rgb(255, 247, 203); 32 | 33 | 34 | 35 | 36 | 37 | 0 38 | 60 39 | 41 40 | 41 41 | 42 | 43 | 44 | 7 45 | 46 | 47 | 48 | 49 | 50 | 40 51 | 60 52 | 41 53 | 41 54 | 55 | 56 | 57 | 8 58 | 59 | 60 | 61 | 62 | 63 | 80 64 | 60 65 | 41 66 | 41 67 | 68 | 69 | 70 | 9 71 | 72 | 73 | 74 | 75 | 76 | 0 77 | 100 78 | 41 79 | 41 80 | 81 | 82 | 83 | 4 84 | 85 | 86 | 87 | 88 | 89 | 40 90 | 100 91 | 41 92 | 41 93 | 94 | 95 | 96 | 5 97 | 98 | 99 | 100 | 101 | 102 | 80 103 | 100 104 | 41 105 | 41 106 | 107 | 108 | 109 | 6 110 | 111 | 112 | 113 | 114 | 115 | 0 116 | 140 117 | 41 118 | 41 119 | 120 | 121 | 122 | 1 123 | 124 | 125 | 126 | 127 | 128 | 40 129 | 140 130 | 41 131 | 41 132 | 133 | 134 | 135 | 2 136 | 137 | 138 | 139 | 140 | 141 | 80 142 | 140 143 | 41 144 | 41 145 | 146 | 147 | 148 | 3 149 | 150 | 151 | 152 | 153 | 154 | 40 155 | 180 156 | 41 157 | 31 158 | 159 | 160 | 161 | 0 162 | 163 | 164 | 165 | 166 | 167 | 0 168 | 180 169 | 41 170 | 31 171 | 172 | 173 | 174 | background-color: rgb(255, 255, 0); 175 | 176 | 177 | CE 178 | 179 | 180 | 181 | 182 | 183 | 80 184 | 180 185 | 41 186 | 31 187 | 188 | 189 | 190 | . 191 | 192 | 193 | 194 | 195 | 196 | 160 197 | 180 198 | 111 199 | 31 200 | 201 | 202 | 203 | = 204 | 205 | 206 | 207 | 208 | 209 | 120 210 | 180 211 | 41 212 | 31 213 | 214 | 215 | 216 | cot 217 | 218 | 219 | 220 | 221 | 222 | 120 223 | 140 224 | 41 225 | 41 226 | 227 | 228 | 229 | tan 230 | 231 | 232 | 233 | 234 | 235 | 120 236 | 100 237 | 41 238 | 41 239 | 240 | 241 | 242 | cos 243 | 244 | 245 | 246 | 247 | 248 | 120 249 | 60 250 | 41 251 | 41 252 | 253 | 254 | 255 | sin 256 | 257 | 258 | 259 | 260 | 261 | 200 262 | 100 263 | 41 264 | 41 265 | 266 | 267 | 268 | / 269 | 270 | 271 | 272 | 273 | 274 | 200 275 | 140 276 | 41 277 | 41 278 | 279 | 280 | 281 | - 282 | 283 | 284 | 285 | 286 | 287 | 160 288 | 140 289 | 41 290 | 41 291 | 292 | 293 | 294 | % 295 | 296 | 297 | 298 | 299 | 300 | 160 301 | 100 302 | 41 303 | 41 304 | 305 | 306 | 307 | log 308 | 309 | 310 | 311 | 312 | 313 | 160 314 | 60 315 | 41 316 | 41 317 | 318 | 319 | 320 | sqrt 321 | 322 | 323 | 324 | 325 | 326 | 200 327 | 60 328 | 41 329 | 41 330 | 331 | 332 | 333 | x 334 | 335 | 336 | 337 | 338 | 339 | 240 340 | 60 341 | 31 342 | 121 343 | 344 | 345 | 346 | + 347 | 348 | 349 | 350 | 351 | 352 | 353 | 0 354 | 0 355 | 272 356 | 22 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Assignment 1 : 2 | ```Several operating system applications``` : 3 | #### 4 | ```arch``` : Indicates whether the system is 32-bit or 64-bit 5 | ```uptime``` : Indicates the current running time of the system and the average system load and the number of users logged into the system 6 | ```free``` : Indicates the amount of memory consumed by the system 7 | ```Pwd``` : Prints the name of the current work path in its entirety, abbreviated as Print Working Directory 8 | ```exit``` : The command is to exit and close the terminal 9 | 10 | ### Solotion 2: 11 | #### 12 | Calculate the circumference and area of a circle . 13 | 14 | ### Solution 3 : 15 | #### 16 | Geometry donor theorem . 17 | 18 | ### Solution 4 : 19 | #### 20 | Calculate BMI a Person . 21 | # Assignment 2 : 22 | ### ```Calculator :``` 23 | - [x] Add two numbers together (Press Num1) + 24 | - [x] Subtract two numbers from each other (Press Num2) - 25 | - [x] Multiply two numbers together (Press Num3) x 26 | - [x] Divided two number (Press Num4) / 27 | - [x] Sinus of an angle (press Num5) Sin 28 | - [x] Cosinus of an angle (Press Num6) Cos 29 | - [x] Tangent of an angle (Press Num7) Tan 30 | - [x] Cotangent of an angle (Press Num8) Cot 31 | - [x] Logarithm a number (Press Num9) log 32 | - [x] Exit and close programm (Press Num10) 33 | 34 | ### Palam,Polom,Plish Game✋🎮🤚 35 | - [x] Play With Two Cpu 36 | - [x] On Hand ✋ (Press Num1) 37 | - [x] Back Hand 🤚 (Press Num2) 38 | - [x] Play in 5 stages and announce the winner 🏆 39 | 40 | ### Rock✊,Paper✋,Scissors🤞,🎮Game🎮 41 | - [x] Play With CPU 42 | - [x] Rock✊ (Press Num1) 43 | - [x] Paper✋ (Press Num2) 44 | - [x] Scissors ✌️ (Press Num3) 45 | - [x] Play in 5 stages and announce the winner 🏆 46 | 47 | ### Seconds to Time : 48 | #### 49 | Convert seconds to time format (ex. 3661 sec == 1:01:01) 50 | 51 | ### Time To Second : 52 | #### 53 | Convert time to second format (ex. 1:01:01 sec == 3661) 54 | # Assignment 3 : 55 | ### 56 | ```KMM & BMM:``` 57 | Find the largest common divisor and the smallest common multiple between two integers 58 | 59 | ### ```HangMan :``` 60 | #### 61 | ![330px-Hangman svg](https://user-images.githubusercontent.com/91725214/155573188-aec5989c-ad0a-4753-b643-2e9d61f8e029.png) 62 | The word to guess is represented by a row of dashes, representing each letter of the word. Rules may permit or forbid proper nouns, such as names, places, brands, or slang. If the guessing player suggests a letter which occurs in the word, the other player writes it in all its correct positions. If the suggested letter does not occur in the word, the other player draws one element of a hanged stick figure as a tally mark. 63 | ### Is Armstrong Number : 64 | #### 65 | The Armstrong number is called a number. If we multiply each of its numbers by the power of the number of numbers, it becomes equal to the number itself. 66 | #### Example : 67 | #### 68 | Consider the number 153 69 | 153 is a three-digit number, so we multiply each of its numbers by the power of three and add it together: 70 | 153 = 1 * 1 * 1 + 5 * 5 * 5 + 3 * 3 * 3 71 | The number 153 is an Armstrong number. 72 | 73 | ### Is Factorial : 74 | #### 75 | Checks if it is a factorial number and returns a Boolean variable in response 76 | Example : 77 | Consider the number 120 = 1 * 2 * 3 * 4 * 5 = 5! 78 | 79 | ### Word Sentence : 80 | #### 81 | Counts the number of words in a sentence 82 | ### Random Array: 83 | #### 84 | Makes a random array with the size that the user gives as input 85 | ### Sort Array: 86 | #### 87 | Checks that the presentation received as input from the user is sorted descending 88 | # Assignment 4 : 89 | ### Multiplication_table : 90 | Create a multiplication table with the number of columns and rows desired by the user 91 | ### chesstable : 92 | Create a checkered page with the number of columns and rows desired by the user in the shape of a star and an hashtag # * 93 | ### fibo : 94 | Create a Fibonacci sequence to the user's liking using the repeat loop 95 | #### 96 | Run in consol: 97 | #### 98 | ![image](https://user-images.githubusercontent.com/91725214/162984659-52db73ee-f68a-40ae-a411-8de84d8eae8e.png) 99 | 100 | # Assignment 5(Store) : 101 | Build a store software based on the CSV database with limited features such as 102 | - [x] Adding new items to the store 103 | - [x] Edit items 104 | - [x] Delete items 105 | - [x] Show items list 106 | - [x] Search items 107 | - [x] Buy items 108 | - [x] Exit 109 | 110 | Each items have : 111 | - Id(bar-code) 112 | - Name 113 | - Price 114 | - Count 115 | 116 | # Assignment 6 (Translator): 117 | Creating a dictionary by a words bank in which all data (words) are stored : 118 | - [x] Persian to English 119 | - [x] English to Persian 120 | 121 | # Assignmen 7 : 122 | ### Khayam-Pascal: 123 | ![400px-Pascal's_Triangle1](https://user-images.githubusercontent.com/91725214/158057027-498e2657-d24f-48a0-bdee-c173c667ecbf.jpg) 124 | #### 125 | www.Wikipedia.com 126 | Print Khayyam Pascal triangle to the user's desired column 127 | ### Symmetrical : 128 | Check the symmetry of a Array numbers 129 | ### Check the symmetry of a number : 130 | The four basic mathematical operations on fractional numbers 131 | - [x] + 132 | - [x] - 133 | - [X] x 134 | - [x] / 135 | - [x] Exit 136 | ### Wedding: 137 | Write a plan for every boy and girl to marry by chance. Note that a boy can not marry two girls at the same time, and vice versa. 138 | 139 | # Assignment 8: 140 | ### **Complex numbers :** 141 | Complex numbers that are displayed in the form **"a + i b"**. Where **a** and **b** are real numbers and **i** are an imaginary part and part a is a real part and part b is an imaginary part 142 | #### 143 | ![330px-Complex_number_illustration svg](https://user-images.githubusercontent.com/91725214/158363257-0f34eb99-22b1-4bc0-b73f-a9af34a1f4f1.png) 144 | #### 145 | **```this program have main menu that work :```** 146 | - [x] sum two complex numbers 147 | - [x] mines two complex numbers 148 | - [x] multi two complex numbers 149 | - [x] exit 150 | ### **Faraction :** 151 | ![download](https://user-images.githubusercontent.com/91725214/158364567-589e24f5-8e53-4f13-b9c0-6f30ea5a4b09.png) 152 | #### 153 | **```this program have main menu that work :```** 154 | - [x] sum two fraction numbers 155 | - [x] mines two fraction numbers 156 | - [x] multi two fraction numbers 157 | - [x] div ide two fraction numbers 158 | - [x] exit 159 | ### **Time :** 160 | ![download](https://user-images.githubusercontent.com/91725214/158364928-9e379a0e-53af-48f9-8449-cda8fe142f39.jpg) 161 | #### 162 | **```this program have main menu that work :```** 163 | - [x] sum two time(E.X 12:20:10 + 5:30:40 = 17:50:50) 164 | - [x] mines two fraction numbers(E.X 12:20:10 - 5:10:10 = 7:10:00) 165 | - [x] time to second (E.X input : 3600 seconds ==> output : 01:00:00) 166 | - [x] divide two fraction numbers (E.X input : 01:00:00 ==> output : 3600 seconds) 167 | - [x] exit 168 | 169 | # Assignment 10 (SQL): 170 | ### Problem description: 171 | Create a database for Digikala with two tables : 172 | - 1- Enter the desired information into the table using the **INSERT** command. 173 | - 2- Show only available items using the **SELECT** command. 174 | - 3- Use the **DELETE** command to delete non-Iranian customers. 175 | - 4- Reduce the price of all items by 20% using the **UPDATE** command. 176 | 177 | 178 | Powerd by sqlitebrowser.org 179 | #### 180 | # Certificate: 181 | www.Sololearn.com 182 | ![png](https://user-images.githubusercontent.com/91725214/158021136-8cfe0576-1326-4bd1-9437-90144023403a.png) 183 | ![png](https://user-images.githubusercontent.com/91725214/158021148-b058526e-67bc-4adb-baa2-64b12a4a1beb.png) 184 | ![png](https://user-images.githubusercontent.com/91725214/157819260-c03c5293-0a5d-4ce4-a967-c1821e041be6.png) 185 | 186 | --------------------------------------------------------------------------------