├── Age Calculator.py ├── Calculator In One Line.py ├── Celebrity picture.py ├── Hashing Passwords.py ├── LICENSE ├── Merry Christmas.py ├── Number hunch game.py ├── Password Cheker.py ├── Practice.py ├── PrimeFilter.py ├── README.md ├── Screen Recorder.py ├── String Methods.py ├── Text To Speach.py ├── Timer.py ├── UrlShortener.py ├── account managment.py ├── atm.py ├── background deleter.py ├── bigger or smaller game.py ├── calendar.py ├── password generator.py └── youtube Downloader.py /Age Calculator.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | 4 | def agecalculator(y, m, d): 5 | today = datetime.datetime.now().date() 6 | dob = datetime.date(y, m, d) 7 | age = int((today - dob).days / 365.25) 8 | print(age) 9 | 10 | 11 | year = int(input("enter year:")) 12 | month = int(input("enter month:")) 13 | day = int(input("enter day:")) 14 | agecalculator(year, month, day) 15 | -------------------------------------------------------------------------------- /Calculator In One Line.py: -------------------------------------------------------------------------------- 1 | print(eval(f"{input()}")) -------------------------------------------------------------------------------- /Celebrity picture.py: -------------------------------------------------------------------------------- 1 | # pip install sketchpy 2 | from sketchpy import library as lib 3 | tom = lib.tom_holland() 4 | tom.draw() -------------------------------------------------------------------------------- /Hashing Passwords.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | 3 | def hash_password(password): 4 | hashed_password = hashlib.sha256(password.encode()).hexdigest() 5 | print("hashed password :" + hashed_password) 6 | 7 | text = input("enter your password : ") 8 | hash_password(text) 9 | 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 SeyedRezaDerakhshan 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 | -------------------------------------------------------------------------------- /Merry Christmas.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | x = np.arange(7, 16) 4 | y = np.arange(1, 18, 2) 5 | z = np.column_stack((x[::-1], y)) 6 | 7 | for i, j in z: 8 | print(" " * i + "*" * j) 9 | for i in range(3): 10 | print(" " * 13, " || ") 11 | 12 | print(" " * 12, end="\======/") 13 | print("") 14 | -------------------------------------------------------------------------------- /Number hunch game.py: -------------------------------------------------------------------------------- 1 | import random 2 | print("Welcome to Number hunch Game") 3 | 4 | ready = input("are you ready?") 5 | 6 | point = 60 7 | print("your pint is 60") 8 | 9 | 10 | for i in range(10): 11 | number = random.randint(1,10) 12 | choose = input("enter a number:") 13 | if choose == number: 14 | result = point + 15 15 | point = result 16 | print(f"you win\npoint:{result}") 17 | if 0 >= point: 18 | print("you lose") 19 | break 20 | else: 21 | result = point - 15 22 | point = result 23 | print(f"you lose\npoint:{result}") 24 | -------------------------------------------------------------------------------- /Password Cheker.py: -------------------------------------------------------------------------------- 1 | # ------------------- Variable ---------------------# 2 | 3 | password = input("enter your password : ") 4 | lowercase_letter = [c for c in password if c.islower()] 5 | spec = ["~", "`", "!", "@", "#", "$", "$", "%", "^", "&", "*", "(", ")"] 6 | uppercase_letter = [c for c in password if c.isupper()] 7 | isnum = [c for c in password if c.isalnum()] 8 | category = "" 9 | point = 0 10 | count = 0 11 | 12 | # ------------------- for ---------------------# 13 | 14 | for char in password: 15 | if char in spec: 16 | count += 1 17 | 18 | 19 | # ------------------- if ---------------------# 20 | 21 | if len(password) < 8: 22 | print("pleas enter good password") 23 | category = "weak" 24 | elif len(password) >= 8 and len(password) < 12: 25 | result = point + 8 + (len(password) * 6) 26 | point = result 27 | category = "medium" 28 | if len(lowercase_letter) == 1: 29 | s = point + 6 30 | point = s 31 | elif len(lowercase_letter) == 2: 32 | s = point + 12 33 | point = s 34 | else: 35 | s = point + 18 36 | point = s 37 | if len(isnum) == 1: 38 | s = point + 6 39 | point = s 40 | elif len(isnum) == 2: 41 | s = point + 12 42 | point = s 43 | else: 44 | s = point + 18 45 | point = s 46 | if len(uppercase_letter) == 1: 47 | s = point + 6 48 | point = s 49 | elif len(uppercase_letter) == 2: 50 | s = point + 12 51 | point = s 52 | else: 53 | s = point + 18 54 | point = s 55 | if count == 1: 56 | s = point + 6 57 | point = s 58 | elif count == 2: 59 | s = point + 12 60 | point = s 61 | else: 62 | s = point + 18 63 | point = s 64 | else: 65 | result = point + 16 66 | point = result 67 | category = "strong" 68 | if len(lowercase_letter) == 1: 69 | s = point + 7 70 | point = s 71 | elif len(lowercase_letter) == 2: 72 | s = point + 14 73 | point = s 74 | else: 75 | s = point + 21 76 | point = s 77 | if len(isnum) == 1: 78 | s = point + 7 79 | point = s 80 | elif len(isnum) == 2: 81 | s = point + 14 82 | point = s 83 | else: 84 | s = point + 21 85 | point = s 86 | if len(uppercase_letter) == 1: 87 | s = point + 7 88 | point = s 89 | elif len(uppercase_letter) == 2: 90 | s = point + 14 91 | point = s 92 | else: 93 | s = point + 21 94 | point = s 95 | if count == 1: 96 | s = point + 7 97 | point = s 98 | elif count == 2: 99 | s = point + 14 100 | point = s 101 | else: 102 | s = point + 21 103 | point = s 104 | 105 | # ------------------- OutPut ---------------------# 106 | 107 | print(f"your password is : {password}\npassword category : {category}\npoint : {point}") 108 | -------------------------------------------------------------------------------- /Practice.py: -------------------------------------------------------------------------------- 1 | #-----1----- 2 | # base = int(input("enter base:\n")) 3 | # height = int(input("enter height:\n")) 4 | # area = base * height 5 | 6 | # print(f"area = {area}") 7 | 8 | #-----2----- 9 | # height = int(input("enter height:\n")) 10 | # radian = int(input("enter radian:\n")) 11 | # volume = height * (radian*radian) * 3 12 | # sur_area = 2 * 3 * radian * height + 2 * (3 * (radian * radian)) 13 | 14 | # print(f"volume:{volume}\nsur area:{sur_area}") 15 | 16 | #-----3----- 17 | # radian = int(input("enter radion:\n")) 18 | # sur_area = 4 * 3 * (radian * radian) 19 | # volume = (4/3) * 3 * (radian * radian) 20 | # print(f"sur area:{sur_area}\nvolume:{volume}") -------------------------------------------------------------------------------- /PrimeFilter.py: -------------------------------------------------------------------------------- 1 | nums = range(1,1000) 2 | 3 | 4 | def is_prime(num): 5 | for x in range(2,num): 6 | if (num%x) == 0: 7 | return False 8 | return True 9 | 10 | primes = list(filter(is_prime,nums)) 11 | 12 | print(primes) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Python Code Repository

2 | 3 |

Welcome to my Python code repository! This repository contains a collection of various Python scripts I've written. Feel free to explore, use, and modify the code.

4 | 5 |

Table of Contents

6 | 14 | 15 |

Description

16 |

This repository includes Python scripts for different purposes, from simple utilities to small applications. Each script is self-contained and demonstrates different aspects of Python programming.

17 | 18 |

Installation

19 |
    20 |
  1. Clone the repository: 21 |
    git clone https://github.com/rezadrakhshan/python-code.git
    22 |
  2. 23 |
  3. Navigate to the project directory: 24 |
    cd python-code
    25 |
  4. 26 |
27 | 28 |

Usage

29 |

Each script can be run independently. To run a script, use the following command:

30 |
python script_name.py
31 |

Replace script_name.py with the name of the script you want to execute.

32 | 33 |

Scripts

34 |

Here are some of the scripts included in this repository:

35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 |
Script NameDescription
Age Calculator.pyCalculate age based on input birth date.
Calculator In One Line.pyA one-line calculator script.
Celebrity picture.pyScript to download a celebrity picture.
Hashing Passwords.pyDemonstrates how to hash passwords.
Merry Christmas.pyA script that prints a Christmas greeting.
Number hunch game.pyA number guessing game.
Password Cheker.pyA password strength checker.
PrimeFilter.pyFilters prime numbers from a list.
Screen Recorder.pyRecords the screen.
String Methods.pyDemonstrates various string methods.
Text To Speech.pyConverts text to speech.
Timer.pyA simple countdown timer.
account managment.pyManages user accounts.
atm.pyA simple ATM simulator.
background deleter.pyDeletes background from images.
bigger or smaller game.pyA game to guess if the next number is bigger or smaller.
calendar.pyDisplays a calendar.
password generator.pyGenerates random passwords.
youtube Downloader.pyDownloads YouTube videos.
UrlShortener.pyLink Shortener.
125 | 126 |

Contributing

127 |

Contributions are welcome! If you have any improvements or new scripts to add, please follow these steps:

128 |
    129 |
  1. Fork the repository.
  2. 130 |
  3. Create a new branch: 131 |
    git checkout -b feature/your-feature
    132 |
  4. 133 |
  5. Commit your changes: 134 |
    git commit -m 'Add some feature'
    135 |
  6. 136 |
  7. Push to the branch: 137 |
    git push origin feature/your-feature
    138 |
  8. 139 |
  9. Open a pull request.
  10. 140 |
141 | 142 |

License

143 |

This project is licensed under the MIT License. See the LICENSE file for details.

144 | 145 | -------------------------------------------------------------------------------- /Screen Recorder.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | import pyautogui 4 | 5 | screen_width, screen_height = pyautogui.size() 6 | resolution = (screen_width, screen_height) 7 | 8 | 9 | output_filename = "test.mp4" 10 | 11 | fps = 30.0 12 | 13 | fourcc = cv2.VideoWriter_fourcc(*"mp4v") 14 | out = cv2.VideoWriter(output_filename, fourcc, fps, resolution) 15 | 16 | recording_duration = 60 17 | 18 | for _ in range(int(fps * recording_duration)): 19 | screen = pyautogui.screenshot() 20 | 21 | frame = np.array(screen) 22 | frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR) 23 | 24 | out.write(frame) 25 | 26 | out.release() -------------------------------------------------------------------------------- /String Methods.py: -------------------------------------------------------------------------------- 1 | text = 'Hello World' 2 | print(text.capitalize()) # ---> Hello world 3 | print(text.casefold()) # ---> hello world 4 | print(text.count('o')) # ---> 2 5 | print(text.find('World')) # ---> 6 6 | print(text.index('Hello')) # ---> 0 7 | print(text.isalnum()) # ---> False 8 | print(text.isalpha()) # ---> False 9 | print(text.isascii()) # ---> True 10 | print(text.isdecimal()) # ---> False 11 | print(text.isdigit()) # ---> False 12 | print(text.isidentifier()) # ---> False 13 | print(text.islower()) # ---> True 14 | print(text.isnumeric()) # ---> False 15 | print(text.isprintable()) # ---> True -------------------------------------------------------------------------------- /Text To Speach.py: -------------------------------------------------------------------------------- 1 | # pip install gtts 2 | from gtts import gTTS 3 | import os 4 | 5 | 6 | language = "en" 7 | 8 | 9 | audio = gTTS(text="hello world",lang=language, slow=False) 10 | 11 | audio.save("1.wav") 12 | os.system("1.wav") 13 | -------------------------------------------------------------------------------- /Timer.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | my_time = int(input("enter time per second: ")) 4 | 5 | 6 | for i in reversed(range(0, my_time)): 7 | print(i) 8 | time.sleep(1) 9 | 10 | print("Time is Up") -------------------------------------------------------------------------------- /UrlShortener.py: -------------------------------------------------------------------------------- 1 | # pip install pyshorteners 2 | 3 | import pyshorteners 4 | import pyshorteners.shorteners 5 | 6 | long_url = input("Enter the URL:") 7 | 8 | type_tiny = pyshorteners.Shortener() 9 | 10 | short_url = type_tiny.tinyurl.short(long_url) 11 | 12 | print(f"The shortened URL is : {short_url}") -------------------------------------------------------------------------------- /account managment.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | 4 | contacts = {} 5 | counter = 1 6 | 7 | 8 | def add_contact(): 9 | global counter 10 | name = input("Please enter the name: ") 11 | last_name = input("Please enter the last name: ") 12 | age = int(input("Please enter the age: ")) 13 | 14 | now = datetime.datetime.now() 15 | year = now.strftime("%y") 16 | month = now.strftime("%m") 17 | 18 | id = year + month + str(counter).zfill(2) 19 | counter += 1 20 | 21 | contacts[id] = {"name": name, "last_name": last_name, "age": age} 22 | print(f"Contact with ID {id} added.") 23 | 24 | 25 | def edit_contact(): 26 | id = input("Enter the ID of the contact to edit: ") 27 | if id in contacts: 28 | name = input("New name: ") 29 | last_name = input("New last name: ") 30 | age = int(input("New age: ")) 31 | contacts[id] = {"name": name, "last_name": last_name, "age": age} 32 | print(f"Contact with ID {id} edited.") 33 | else: 34 | print("The entered ID does not exist.") 35 | 36 | 37 | def remove_contact(): 38 | id = input("Enter the ID of the contact to remove: ") 39 | if id in contacts: 40 | del contacts[id] 41 | print(f"Contact with ID {id} removed.") 42 | else: 43 | print("The entered ID does not exist.") 44 | 45 | 46 | def search_contact(): 47 | id = input("Enter the ID of the contact to search: ") 48 | if id in contacts: 49 | print( 50 | f"Contact Information:\nName: {contacts[id]['name']}\nLast Name: {contacts[id]['last_name']}\nAge: {contacts[id]['age']}" 51 | ) 52 | else: 53 | print("No contact found with this ID.") 54 | 55 | 56 | while True: 57 | print("Menu:") 58 | print("1. Add") 59 | print("2. Edit") 60 | print("3. Remove") 61 | print("4. Search") 62 | print("5. Exit") 63 | 64 | choice = int(input("Please enter the number of your choice: ")) 65 | if choice == 1: 66 | add_contact() 67 | elif choice == 2: 68 | edit_contact() 69 | elif choice == 3: 70 | remove_contact() 71 | elif choice == 4: 72 | search_contact() 73 | elif choice == 5: 74 | break 75 | else: 76 | print("Invalid choice.") 77 | -------------------------------------------------------------------------------- /atm.py: -------------------------------------------------------------------------------- 1 | from time import gmtime, strftime 2 | 3 | def ATM(): 4 | password = input("enter your password:") 5 | time = strftime("%a, %d %b %Y %H:%M:%S ", gmtime()) 6 | print(""" 7 | 1-transfer cash 8 | 2-gift card 9 | 3-withdraw money 10 | 4-by charge 11 | """) 12 | userchoice = int(input("enter your choice:")) 13 | if userchoice == 1: 14 | account_numebr = int(input("enter your account numebr:")) 15 | account_numebr2 = int(input("enter destination account number:")) 16 | print(""" 17 | 1-5$ 18 | 2-10$ 19 | 3-20$ 20 | 4-40$ 21 | 5-50$ 22 | """) 23 | userchoice2 = input("enter amount:(like=20$)") 24 | 25 | if userchoice2 == "5$": 26 | print(f"account number : {account_numebr}\ndestination account numebr : {account_numebr2}\namount : {userchoice2}\ntime : {time}\nBOZORGATM") 27 | if userchoice2 == "10$": 28 | print(f"account number : {account_numebr}\ndestination account numebr : {account_numebr2}\namount : {userchoice2}\ntime : {time}\nBOZORGATM") 29 | if userchoice2 == "20$": 30 | print(f"account number : {account_numebr}\ndestination account numebr : {account_numebr2}\namount : {userchoice2}\ntime : {time}\nBOZORGATM") 31 | if userchoice2 == "40$": 32 | print(f"account number : {account_numebr}\ndestination account numebr : {account_numebr2}\namount : {userchoice2}\ntime : {time}\nBOZORGATM") 33 | if userchoice2 == "50$": 34 | print(f"account number : {account_numebr}\ndestination account numebr : {account_numebr2}\namount : {userchoice2}\ntime : {time}\nBOZORGATM") 35 | if userchoice == 2: 36 | print(""" 37 | 1-birthday gift 38 | 2-baby gift 39 | 3-New house gift 40 | 4-wedding gift 41 | """) 42 | input1 = input("choose card type:(string)") 43 | if input1 == "birthday gift": 44 | print(""" 45 | 1-5$ 46 | 2-10$ 47 | 3-20$ 48 | 4-40$ 49 | 5-50$ 50 | """) 51 | input2 = input("choose amount:(like=10$)") 52 | if userchoice2 == "5$": 53 | input3 = input("enter text:") 54 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 55 | 56 | if userchoice2 == "10$": 57 | input3 = input("enter text:") 58 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 59 | if userchoice2 == "20$": 60 | input3 = input("enter text:") 61 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 62 | if userchoice2 == "40$": 63 | input3 = input("enter text:") 64 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 65 | if userchoice2 == "50$": 66 | input3 = input("enter text:") 67 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 68 | if input1 == "baby gift": 69 | print(""" 70 | 1-5$ 71 | 2-10$ 72 | 3-20$ 73 | 4-40$ 74 | 5-50$ 75 | """) 76 | input2 = input("choose amount:") 77 | if input2 == "5$": 78 | input3 = input("enter text:") 79 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 80 | if input2 == "10$": 81 | input3 = input("enter text:") 82 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 83 | if input2 == "20$": 84 | input3 = input("enter text:") 85 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 86 | if input2 == "40$": 87 | input3 = input("enter text:") 88 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 89 | if input2 == "50$": 90 | input3 = input("enter text:") 91 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 92 | if input1 == "New house gift": 93 | print(""" 94 | 1-5$ 95 | 2-10$ 96 | 3-20$ 97 | 4-40$ 98 | 5-50$ 99 | """) 100 | input2 = input("choose amount:") 101 | if input2 == "5$": 102 | input3 = input("enter text:") 103 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 104 | if input2 == "10$": 105 | input3 = input("enter text:") 106 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 107 | if input2 == "20$": 108 | input3 = input("enter text:") 109 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 110 | if input2 == "40$": 111 | input3 = input("enter text:") 112 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 113 | if input2 == "50$": 114 | input3 = input("enter text:") 115 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 116 | if input1 == "wedding gift": 117 | print(""" 118 | 1-5$ 119 | 2-10$ 120 | 3-20$ 121 | 4-40$ 122 | 5-50$ 123 | """) 124 | input2 = input("choose amount:") 125 | if input2 == "5$": 126 | input3 = input("enter text:") 127 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 128 | if input2 == "10$": 129 | input3 = input("enter text:") 130 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 131 | if input2 == "20$": 132 | input3 = input("enter text:") 133 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 134 | if input2 == "40$": 135 | input3 = input("enter text:") 136 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 137 | if input2 == "50$": 138 | input3 = input("enter text:") 139 | print(f"Card type : {input1}\namount : {input2}\ntext : {input3}\ntime : {time}\nBOZORGATM") 140 | if userchoice == 3: 141 | print(""" 142 | 1-5$ 143 | 2-10$ 144 | 3-20$ 145 | 4-40$ 146 | 5-50$ 147 | 6-i bring in 148 | """) 149 | amount = input("enter amount:(like=50$)") 150 | if amount == "5$": 151 | print(f"amount : {amount}\ntime : {time}\nBOZORGATM") 152 | if amount == "10$": 153 | print(f"amount : {amount}\ntime : {time}\nBOZORGATM") 154 | if amount == "20$": 155 | print(f"amount : {amount}\ntime : {time}\nBOZORGATM") 156 | if amount == "40$": 157 | print(f"amount : {amount}\ntime : {time}\nBOZORGATM") 158 | if amount == "50$": 159 | print(f"amount : {amount}\ntime : {time}\nBOZORGATM") 160 | if amount == "i bring in": 161 | price = input("enter amount(max=200$)") 162 | print(f"amount : {price}\ntime : {time}\nBOZORGATM") 163 | if userchoice == 4: 164 | print(""" 165 | 1-by charge 166 | 2-transfer charge 167 | """) 168 | user_choice = int(input("enter your choice:(int)")) 169 | if user_choice == 1: 170 | numebr = int(input("enetr your number:")) 171 | charge = int(input("enter the amount of charge you want:")) 172 | print(f"numebr : {numebr}\ncharge : {charge}\ntime : {time}\nBOZORGATM") 173 | if user_choice == 2: 174 | origin_number = int(input("enter origin numeber:")) 175 | destination_number = int(input("enter destination numeber:")) 176 | charge = int(input("enter the amount of charge you want:")) 177 | print(f"origin number : {origin_number}\ndestination number : {destination_number}\ncharge : {charge}\ntime : {time}\nBOZORGATM") 178 | ATM() 179 | for i in range(1000): 180 | mm = input("do you have another transaction?(yes|no)") 181 | if mm == "yes": 182 | ATM() 183 | else: 184 | print("thank you for use BOZORGATM") 185 | break 186 | -------------------------------------------------------------------------------- /background deleter.py: -------------------------------------------------------------------------------- 1 | # pip install rembg 2 | from rembg import remove 3 | from PIL import Image 4 | 5 | input_path = '' 6 | output_path = '' 7 | 8 | inp = Image.open(input_path) 9 | output = remove(inp) 10 | output.save(output_path) 11 | print('done') -------------------------------------------------------------------------------- /bigger or smaller game.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | 4 | print("----welcome to this game----") 5 | 6 | point = 60 7 | num1 = random.randint(1,10) 8 | print(num1) 9 | 10 | 11 | for i in range(10): 12 | num2 = random.randint(1,10) 13 | choices = input("the next number is bigger than pervius number or no?") 14 | if point <= 0: 15 | print("you lose") 16 | break 17 | if choices == "yes" and num2 > num1: 18 | result = point + 15 19 | point = result 20 | num1 = num2 21 | print(f"win\nnumber2:{num2}\npoint:{point}") 22 | else: 23 | result = point - 15 24 | point = result 25 | num1 = num2 26 | print(f'lose\nnumber2:{num2}\npoint:{point}') -------------------------------------------------------------------------------- /calendar.py: -------------------------------------------------------------------------------- 1 | import calendar 2 | 3 | year = int(input("enter year:")) 4 | month = int(input("enter month:")) 5 | 6 | page = calendar.month(year, month) 7 | print(page) -------------------------------------------------------------------------------- /password generator.py: -------------------------------------------------------------------------------- 1 | import random 2 | import string 3 | print(""" 4 | ----enter type of password---- 5 | 1-String 6 | 2-Integer 7 | 3-Both 8 | """) 9 | type = int(input("enter your choice(1/2/3):")) 10 | 11 | if type == 2: 12 | S = 10 13 | ran = ''.join(random.choices(string.digits, k = S)) 14 | print(ran) 15 | if type ==1: 16 | S = 10 17 | ran = ''.join(random.choices(string.ascii_uppercase , k = S)) 18 | print("your password is :" + str(ran)) 19 | if type == 3: 20 | S = 10 21 | ran = ''.join(random.choices(string.ascii_uppercase + string.digits, k = S)) 22 | print(ran) 23 | -------------------------------------------------------------------------------- /youtube Downloader.py: -------------------------------------------------------------------------------- 1 | from pytube import YouTube 2 | 3 | link = input("link: ") 4 | 5 | yt = YouTube(link) 6 | 7 | 8 | video = yt.streams.get_highest_resolution() 9 | 10 | video.download() 11 | 12 | print("done!") --------------------------------------------------------------------------------