├── .gitignore ├── Mile to Kilometers Converter Project └── main.py ├── QR_code_Generater.py ├── README.md ├── ascii_art.py ├── calcluter.py ├── fizz_buzz_program ├── images │ └── favicon.ico └── main.py ├── gender_age_guss_website ├── server.py └── templates │ ├── index.html │ └── index1.html ├── higher-lower-site ├── __pycache__ │ └── server.cpython-310.pyc └── server.py ├── kanye_quotes_program ├── background.png ├── kanye.png └── main.py ├── liron_blog_website ├── __pycache__ │ └── post.cpython-310.pyc ├── main.py ├── post.py ├── static │ └── css │ │ └── styles.css └── templates │ ├── index.html │ └── post.html ├── main.py ├── math_program ├── images │ ├── cheat_sheet-modified1.png │ ├── cos-modified.png │ ├── def_limt1.png │ ├── def_limt2.png │ ├── favicon.ico │ ├── integral2.png │ ├── lim_icon.png │ ├── send-modified1.png │ ├── sin-modified1.png │ ├── tan-modified1.png │ ├── trig-modified1.png │ └── trig_banner3.png ├── main.py └── math_cheat_sheet │ ├── integral.txt │ ├── lim.txt │ ├── liron.txt │ └── trig.txt ├── nato_phonetic_alphabet ├── main.py └── nato_phonetic_alphabet.csv ├── password-manager ├── data.json ├── logo.png └── main.py ├── pomodoro_project ├── main.py └── tomato.png ├── pong_game ├── __pycache__ │ ├── ball.cpython-310.pyc │ ├── paddle.cpython-310.pyc │ └── pong_score_board.cpython-310.pyc ├── ball.py ├── liron_pong_game.py ├── paddle.py └── pong_score_board.py ├── quiz-app ├── data.py ├── images │ ├── false.png │ └── true.png ├── main.py ├── question_model.py ├── quiz_brain.py └── ui.py ├── runner_game ├── Fly1.png ├── Fly2.png ├── Pixeltype.ttf ├── audio_jump.mp3 ├── game.py ├── ground.png ├── jump.png ├── music.wav ├── player_stand.png ├── player_walk_1.png ├── player_walk_2.png ├── snail1.png └── snail2.png ├── snake_game ├── __pycache__ │ ├── food.cpython-310.pyc │ ├── score_board.cpython-310.pyc │ └── snake.cpython-310.pyc ├── data.txt ├── food.py ├── liron_snake_game.py ├── score_board.py └── snake.py ├── sudoku solver.py ├── tindog_website ├── css │ └── styles.css ├── images │ ├── TechCrunch.png │ ├── bizinsider.png │ ├── dog-img.jpg │ ├── iphone6.png │ ├── lady-img.jpg │ ├── liav_image.jpg │ ├── mashable.png │ └── tnw.png └── index.html ├── turtle_projects ├── clock_turtle_program.py ├── hirst_jpg.webp ├── liron_draw_program.py ├── liron_hirst_panting.py ├── liron_spirograph.py ├── liron_turtle_game.py ├── lliron_turtle_race_game.py └── project │ ├── __pycache__ │ ├── car_manger.cpython-310.pyc │ ├── player.cpython-310.pyc │ └── scoreboard.cpython-310.pyc │ ├── car_manger.py │ ├── main.py │ ├── player.py │ └── scoreboard.py └── us_states_game ├── 50_states.csv ├── blank_states_img.gif ├── main.py └── need_to_learn.csv /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | -------------------------------------------------------------------------------- /Mile to Kilometers Converter Project/main.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | 3 | window = tkinter.Tk() 4 | 5 | # Constants 6 | 7 | LABEL_FONT = ("Ariel", 10) 8 | MILE_TO_KILOMETERS = 1.609 9 | 10 | def main(): 11 | window.title("liron mile to kilometers program") 12 | window.minsize(width=350, height=200) 13 | 14 | # label in left middle of the screen 15 | label_is_equal_to = tkinter.Label(text="is equal to ", font=LABEL_FONT, padx=30, pady=20) 16 | label_is_equal_to.grid(column=0, row=1) 17 | 18 | # label in right upper screen 19 | label_miles = tkinter.Label(text="Miles ", font=LABEL_FONT, padx=30, pady=20) 20 | label_miles.grid(column=3, row=0) 21 | 22 | # label in right middle screen 23 | label_km = tkinter.Label(text="Km ", font=LABEL_FONT, padx=30, pady=20) 24 | label_km.grid(column=3, row=1) 25 | 26 | # user input in middle up screen 27 | entry_mile_input = tkinter.Entry(width=10) 28 | entry_mile_input.insert(tkinter.END, string="0") 29 | entry_mile_input.grid(column=2, row=0) 30 | 31 | # output to user 32 | label_km_output = tkinter.Label(text="0 ", font=LABEL_FONT, padx=30, pady=20) 33 | label_km_output.grid(column=2, row=1) 34 | 35 | def mile_to_kilometer() -> None: 36 | """ 37 | convert mile to kilometers round the number and show on screen 38 | Parameters: None 39 | Returns: None 40 | """ 41 | miles_value = float(entry_mile_input.get()) 42 | km_value = round(miles_value * MILE_TO_KILOMETERS) 43 | label_km_output.config(text=f"{km_value}") 44 | 45 | # button that calls convert_mile_to_kilometers() when pressed 46 | button = tkinter.Button(text="Convert", command=mile_to_kilometer) 47 | button.grid(column=2, row=2) 48 | 49 | window.mainloop() 50 | 51 | 52 | if __name__ == "__main__": 53 | main() 54 | -------------------------------------------------------------------------------- /QR_code_Generater.py: -------------------------------------------------------------------------------- 1 | import pyqrcode 2 | from tkinter import messagebox 3 | from tkinter import Tk, Label, StringVar, Entry, Button, BitmapImage 4 | 5 | FONT = ("Courier", 30) 6 | 7 | # Tk object 8 | tk = Tk() 9 | # Define the settings of the window 10 | tk.title("liron QR_generator") 11 | tk.config(bg="#E8DFCA") 12 | 13 | def generate_qr()->None: 14 | """ 15 | the function generator QR code 16 | param: none 17 | return: none 18 | """ 19 | global qr, image 20 | # Checking user input 21 | if len(user_input.get()) != 0: 22 | qr = pyqrcode.create(user_input.get()) 23 | image = BitmapImage(data=qr.xbm(scale=10)) 24 | else: 25 | messagebox.showwarning("warning", "fields are required!!") 26 | try: 27 | display_code() 28 | except: 29 | pass 30 | 31 | def display_code()->None: 32 | """ 33 | the function display the qr code 34 | param: none 35 | return: none 36 | """ 37 | image_label.config(image=image) 38 | output.config(text=f"Qr code : {user_input.get()}") 39 | 40 | label = Label(tk, text="enter Text or Url", bg="#F25252", padx=30, pady=20, font=FONT) 41 | label.pack(pady=15) 42 | 43 | user_input = StringVar() 44 | entry = Entry(tk, textvariable=user_input, width=50, font=FONT) 45 | entry.pack(padx=40, pady=30) 46 | 47 | button = Button(tk, text="generate qr", width=20, command=generate_qr, font=FONT) 48 | button.pack(padx=15, pady=15) 49 | 50 | image_label = Label(tk, bg="#e6e6e6") 51 | image_label.pack() 52 | 53 | output = Label(tk, text="", bg="#F25252") 54 | output.pack(pady=15) 55 | 56 | tk.mainloop() -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

🐍 python_mini_projects 🐍

3 | 4 | 5 | 6 | my python mini projects as part of 100 days of code course on udemy and some of them just for fun🤯. 7 | 8 | ![](http://ForTheBadge.com/images/badges/made-with-python.svg) 9 |
10 | ![](https://img.shields.io/tokei/lines/github/lironmiz/python_mini_projects?color=red&label=Lines%20of%20Code) 11 | ![Size](https://img.shields.io/github/repo-size/lironmiz/python_mini_projects?color=red&label=Repo%20Size%20) 12 | 13 | 14 |
15 | 16 | 17 | 18 | # :notebook_with_decorative_cover: Table of Contents 19 | 20 | 21 | 22 | - [The Graduation Certificate](#star2-the-graduation-certificate) 23 | - [Course Material](#books-course-material) 24 | - [Some Of The Projects](#sparkles-some-of-the-projects) 25 | - [Contact](#handshake-contact) 26 | - [Acknowledgements](#gem-acknowledgements) 27 | 28 |
29 | 30 | 31 | # :star2: The Graduation Certificate 32 | 33 | ![image](https://user-images.githubusercontent.com/91504420/212911957-b12ef080-cc73-414b-af52-6c50939e0fcf.png) 34 | 35 | ![ItsOfficialGIF](https://user-images.githubusercontent.com/91504420/213181015-4098c4d8-4092-4608-bcdf-162f1d40a90e.gif) 36 | 37 | 38 |

(back to top)

39 | 40 | 41 | 42 | # :books: Course Material 43 | + Python 3 - the latest version of Python 44 | + PyCharm, Jupter Notebook, Google Colab 45 | + Python Scripting and Automation 46 | + Python Game Developmenment 47 | + Web Scraping 48 | + Beautiful Soup 49 | + Selenium Web Driver 50 | + Request 51 | + WTFormes 52 | + Data Science 53 | + Pandas 54 | + NumPy 55 | + Matplotlibe 56 | + Plotly 57 | + Scikit learn 58 | + Seaborn 59 | + Turtle 60 | + Python GUI Desktop App Development 61 | + Tkinter 62 | + Front-End Web Development 63 | + HTML 5 64 | + CSS 3 65 | + Bootstrap 4 66 | + Bash Command Line 67 | + Git, GitHub and Version Control 68 | + Backend Web Development 69 | + Flask 70 | + REST 71 | + APIs 72 | + Databases 73 | + SQL 74 | 75 |

(back to top)

76 | 77 | 78 | 79 | 80 | 81 | # :sparkles: Some Of The Projects 82 | 83 | ## Project 1️⃣ -> Sudoku Solver 84 | 85 | ### about the project: 86 | 87 | a simple program that solve sudoku. you enter the state of the sudoku at the start state and it print you the sudoku board solved using numpy. 88 | 89 | ### pictures of the project: 90 | 91 | ![image](https://user-images.githubusercontent.com/91504420/210162750-8c9ad336-65b8-42c6-b681-78ed2b54eff9.png) 92 | 93 | ## Project 2️⃣ -> Calcluter 94 | 95 | ### about the project: 96 | 97 | basic gui calcluter using tkinter. 98 | 99 | ### pictures of the project: 100 | 101 | ![image](https://user-images.githubusercontent.com/91504420/210162847-f99f2372-77a4-46e4-904c-499b480cf497.png) 102 | 103 | ![image](https://user-images.githubusercontent.com/91504420/210162853-a4b7a495-b7ed-4e06-9bd5-365399445213.png) 104 | 105 | ## Project 3️⃣ -> QR Code Generater 106 | 107 | ### about the project: 108 | 109 | basic gui for generate qr code for links or text using pyqrcode and tkinter. 110 | 111 | ### pictures of the project: 112 | 113 | ![image](https://user-images.githubusercontent.com/91504420/210162969-210b02e9-149c-4011-893c-c36f8eafc5d9.png) 114 | 115 | ![WhatsApp Image 2023-01-01 at 08 46 47](https://user-images.githubusercontent.com/91504420/210163065-1c20d333-12d2-479c-9136-484afd058bd2.jpg) 116 | 117 | ## Project 4️⃣ -> Us States Game 118 | 119 | ### about the project: 120 | 121 | basic gui game using pandas and turtle When it is based on the countries in America, when the user is asked to enter as many names of countries that he remembers in America, and if he entered the name of a valid country, the name appears in its location on the map, and at the end a csv file of countries is created that the user needs to learn. 122 | 123 | ### Pictures Of The Project: 124 | 125 | ![image](https://user-images.githubusercontent.com/91504420/210163591-bb0aaa2f-b3ed-4d54-b8ac-6fdb21756fee.png) 126 | 127 | ![image](https://user-images.githubusercontent.com/91504420/210163597-da49d47c-12b8-42c2-b325-9bed5eb237e5.png) 128 | 129 | ## Project 5️⃣ -> Turtles Race Game 130 | 131 | ### about the project: 132 | 133 | basic gui race game using turtle When there are 5 turtles of different colors and the user is asked to choose the color of the turtle he thinks will win the race when at the end of the race the user is shown on the terminal if his guess was successful or not 134 | 135 | ### pictures of the project: 136 | 137 | ![image](https://user-images.githubusercontent.com/91504420/210163838-17769509-109e-4ed9-947e-df0e42f98569.png) 138 | 139 | ![image](https://user-images.githubusercontent.com/91504420/210163840-492dd34a-0e7e-491f-8458-36559360012e.png) 140 | 141 | ![image](https://user-images.githubusercontent.com/91504420/210163859-2b7dfeaf-9d86-43f0-8591-9df55198fff3.png) 142 | 143 | ## Project 6️⃣ -> Race Game 144 | 145 | ### about the project: 146 | 147 | basic gui race game using turtle When there are two players and each time a die is rolled and the distance the player advances depends on the result of the roll of the die which is random with an equal chance for each side of the die 148 | 149 | ### pictures of the project: 150 | 151 | ![image](https://user-images.githubusercontent.com/91504420/210164036-3db95495-f858-4626-83ec-958141538cb5.png) 152 | 153 | ![image](https://user-images.githubusercontent.com/91504420/210164044-1c59347e-c71f-44fc-986c-7dafa9850ac3.png) 154 | 155 | ![image](https://user-images.githubusercontent.com/91504420/210164053-cec71361-0d9a-4d15-b08e-efaaeb6547e3.png) 156 | 157 | ## Project 7️⃣ -> Spirograph 158 | 159 | ### about the project: 160 | 161 | basic gui spirograph created by using mathematics and geometry where the size of the radius of the circle can be determined and the colors are automatically selected 162 | 163 | ### pictures of the project: 164 | 165 | ![image](https://user-images.githubusercontent.com/91504420/210164135-c7e6c7f7-6f42-4688-847c-eb28b1c18250.png) 166 | 167 | ![image](https://user-images.githubusercontent.com/91504420/210164182-0e3de85e-35f2-474f-ad00-743815d1ca68.png) 168 | 169 | ## Project 8️⃣ -> Hirst Panting 170 | 171 | ### about the project: 172 | 173 | basic gui art project in turtle that make hirst painting. hirst painting is a famous work of art by damien hirst's 174 | 175 | ### pictures of the project: 176 | 177 | ![image](https://user-images.githubusercontent.com/91504420/210164340-2d2c9927-520c-4559-99ac-4755d62303e3.png) 178 | 179 | ## Project 9️⃣ -> Draw Program 180 | 181 | ### about the project: 182 | 183 | gui draw desktop app under the control of the keyboard when the user has options to move forward straight back right and left increase the size of the pen or decrease it change color and delete the drawing 184 | 185 | ### pictures of the project: 186 | 187 | ![image](https://user-images.githubusercontent.com/91504420/210164835-a1b0af18-fedd-4943-ab6e-bf74d9d38939.png) 188 | 189 | ## Project 1️⃣0️⃣ -> Clock 190 | 191 | ### about the project: 192 | 193 | basic gui clock program that show the current time and updated each minute. 194 | 195 | ### pictures of the project: 196 | 197 | ![image](https://user-images.githubusercontent.com/91504420/210176265-0b2ed792-40d8-4cd0-ab94-e9d3a32d64f9.png) 198 | 199 | ## Project 1️⃣1️⃣ -> Turtle Crossy Road 200 | 201 | ### about the project: 202 | 203 | gui game similar to the popular game crossy road when you can only move forward and you have to escape from blocks that are created in random positions on the screen with random colors and you have to move forward while avoiding collision with them when there are stages and when their speed stage increases. also the game was build with principles of oop 204 | 205 | ### pictures of the project: 206 | 207 | ![image](https://user-images.githubusercontent.com/91504420/210176591-2f8ea2eb-4888-4e00-a770-1deec35d434c.png) 208 | 209 | ![image](https://user-images.githubusercontent.com/91504420/210176600-ea4d9e2e-8678-44f8-81ac-3a03f9d359dd.png) 210 | 211 | ## Project 1️⃣2️⃣ -> Snake Game 212 | 213 | ### about the project: 214 | 215 | gui snake game like the classic and beloved game you can move forward with the arrows right up left and down and you have to eat an apple to increase the length of the snake and not hit the borders of the screen and yourself and the best score is save in data.txt file and bulid with principles of oop 216 | 217 | ### pictures of the project: 218 | 219 | ![image](https://user-images.githubusercontent.com/91504420/210177105-ee9201f7-0bc5-40fc-8f3d-e08a6a71349d.png) 220 | 221 | ## Project 1️⃣3️⃣ -> Quiz App 222 | 223 | ### about the project: 224 | 225 | gui quiz game where you have 10 questions that are randomly selected from a question pool, all questions are true or false questions.and the score of the user is save and go up by one each correct question and bulid with principles of oop 226 | 227 | ### pictures of the project: 228 | 229 | ![image](https://user-images.githubusercontent.com/91504420/210177874-08e5bbc0-cda1-4f2a-a355-d29e4e362dfc.png) 230 | 231 | ![image](https://user-images.githubusercontent.com/91504420/210177893-c520a9a6-7455-4629-88b0-5be20e4cf9ce.png) 232 | 233 | ## Project 1️⃣4️⃣ -> Pong Game 234 | 235 | ### about the project: 236 | 237 | gui pong game Like the well-known favorite game where the speed of the ball increases every time someone wins a point is built with oop principles 238 | 239 | ### pictures of the project: 240 | 241 | ![image](https://user-images.githubusercontent.com/91504420/210183192-7eb062e1-7b99-4c9d-9e4a-02ce03da314c.png) 242 | 243 | ![image](https://user-images.githubusercontent.com/91504420/210183197-38a18bec-1406-4d4a-bba3-3364e011c3c8.png) 244 | 245 | ## Project 1️⃣5️⃣ -> Simple Converter 246 | 247 | ### about the project: 248 | 249 | gui converter that convert mile to kilometers. 250 | 251 | ### pictures of the project: 252 | 253 | ![image](https://user-images.githubusercontent.com/91504420/210183257-796b5e82-0139-49fe-b887-e772e529e741.png) 254 | 255 | ## Project 1️⃣6️⃣ -> Fizz Buzz Program 256 | 257 | ### about the project: 258 | 259 | gui fizz buzz program using tkinter, threading and mathematics and with given a number, the program returns all numbers from zero to the number that divides the number without a remainder 260 | 261 | ### pictures of the project: 262 | 263 | ![image](https://user-images.githubusercontent.com/91504420/210183385-7db126d1-c92e-4efb-8b84-73e43c851377.png) 264 | 265 | ![image](https://user-images.githubusercontent.com/91504420/210183426-58816d31-cdc5-48b3-b973-0e1a6dda00e7.png) 266 | 267 | ## Project 1️⃣7️⃣ -> Gender Age Guss Website 268 | 269 | ### about the project: 270 | 271 | A site whose server is written in python with flask and the frontend with html5 in use with an api that you enter a name for and it with the help of an api makes an assessment of your gender and your age and shows it to you on the screen with nice gifs. 272 | 273 | ### pictures of the project: 274 | 275 | ![image](https://user-images.githubusercontent.com/91504420/210183786-59644836-0fe8-4a39-9c76-dc455d4f2e51.png) 276 | 277 | ![image](https://user-images.githubusercontent.com/91504420/210183866-f2d2c440-9d88-43d4-9fc3-e1dc7493e985.png) 278 | 279 | 280 | ![image](https://user-images.githubusercontent.com/91504420/210183854-b48561cf-bd76-450d-9b6b-31988819f1ff.png) 281 | 282 | ## Project 1️⃣8️⃣ -> Higher Lower Site 283 | 284 | ### about the project: 285 | 286 | A site whose server is written in python with flask and the frontend with html5 with the user need to guess a number between 1 and 10 when each guess is shown to the user if his guess is correct higher or lower combined with a suitable and nice gif 287 | 288 | ### pictures of the project: 289 | 290 | ![image](https://user-images.githubusercontent.com/91504420/210184061-f36d57ba-8482-4813-bf28-1df004e38d48.png) 291 | 292 | ![image](https://user-images.githubusercontent.com/91504420/210184068-70fe8187-5e2d-496b-af56-6ac335248b4d.png) 293 | 294 | ![image](https://user-images.githubusercontent.com/91504420/210184077-c8eb52e5-8020-4cf9-91d1-1bbd79d22fe3.png) 295 | 296 | ![image](https://user-images.githubusercontent.com/91504420/210184091-4ce98cb2-c58a-4427-a88f-5f4f45b2f542.png) 297 | 298 | ## Project 1️⃣9️⃣ -> Kanye Quotes Program 299 | 300 | ### about the project: 301 | 302 | a simple program that show quotes of kanye using tkinter and api to get the quotes. 303 | 304 | ### pictures of the project: 305 | 306 | ![image](https://user-images.githubusercontent.com/91504420/210184207-7f168100-4463-46ef-8505-40b62a39b1cd.png) 307 | 308 | ![image](https://user-images.githubusercontent.com/91504420/210184229-74355580-5a74-434c-889a-93687ddd6d9e.png) 309 | 310 | ![image](https://user-images.githubusercontent.com/91504420/210184241-9eb33373-1ac6-46f2-9bd4-a9eee4a69752.png) 311 | 312 | ## Project 2️⃣0️⃣ -> My Blog Website 313 | 314 | ### about the project: 315 | 316 | a simple blog website using flask and python as as a server language and for frontend it use html5 and css3 317 | 318 | ### pictures of the project: 319 | 320 | ![image](https://user-images.githubusercontent.com/91504420/210184450-db4d8546-7c0e-4d74-98f8-9194d1c8f55e.png) 321 | 322 | ![image](https://user-images.githubusercontent.com/91504420/210184480-e57133d6-cd7c-4100-9e59-88cc5f38005d.png) 323 | 324 | ## Project 2️⃣1️⃣ -> Math Program 325 | 326 | ### about the project: 327 | 328 | math program using tkinter, threding, numpy, sympy, matplotlib and PIL. when every subject in mathematics is a world. When I did three worlds. The trig world, the world of integrals, and the world of limits. Three important branches of mathematics. 329 | 330 | When in the trig world there are calculations of degrees to radians. In addition, there is a place where you enter a trigonometric function that you want with the parameters that you want and it creates a separate page for you with the function. 331 | 332 | And in addition there is the use of a file system in which I prepared a summary for each topic and you can write in it and move between the summaries. 333 | 334 | In the world of limits there is the definition of lim. and a calculator for calculating limits. You enter the function and the point where you want the limit to be calculated and it calculates it for you even if you want infinity. 335 | 336 | In the world of integrals you have an integral calculator. where you can write the function you want to integrate and its limits and it calculates it for you. I really enjoyed building out this project as I learned a lot from it. 337 | 338 | ### pictures of the project: 339 | 340 | ![image](https://user-images.githubusercontent.com/91504420/210185139-c1734e0c-2a09-457c-9d6b-75184098e109.png) 341 | 342 | ![image](https://user-images.githubusercontent.com/91504420/210185199-5369849c-b03c-4e51-a008-326229f319d0.png) 343 | 344 | ![image](https://user-images.githubusercontent.com/91504420/210185263-7b0cb087-f776-4fd3-bdaa-d6729c58ec88.png) 345 | 346 | ![image](https://user-images.githubusercontent.com/91504420/210185360-83e9c791-23e8-4b41-ab73-726bba3df975.png) 347 | 348 | ![image](https://user-images.githubusercontent.com/91504420/210185445-c39e9562-6749-458c-8073-39efb5c945d3.png) 349 | 350 | ## Project 2️⃣2️⃣ -> Password Manager 351 | 352 | ### about the project: 353 | 354 | a simple password manager when you can do a search for passwords for websites you have previously entered information on, you can enter passwords for new websites and even ask the software to generate a random password for you 355 | 356 | ### pictures of the project: 357 | 358 | ![image](https://user-images.githubusercontent.com/91504420/210185938-d9085de9-df1d-48af-a2a1-51c181263fee.png) 359 | 360 | ![image](https://user-images.githubusercontent.com/91504420/210185955-7e4e29e7-9997-4e29-a918-ee4783228063.png) 361 | 362 | ![image](https://user-images.githubusercontent.com/91504420/210185966-a3331c83-07d6-46bf-9ac0-a4972c0b39d7.png) 363 | 364 | ## Project 2️⃣3️⃣ -> Pomodoro Program 365 | 366 | ### about the project: 367 | 368 | A graphical application that implements the Pomodoro method - time management method 369 | and the method say you need to set timer to 25 minutes and focus on a single task until the time stops after that you can enjoy 5 min break after four like this you can take a longer break for 15 - 30 min. and this what the porgram do. 370 | 371 | ### pictures of the project: 372 | 373 | ![image](https://user-images.githubusercontent.com/91504420/210186299-44d8f12e-26b0-4f16-8b4e-2a3a1f69332a.png) 374 | 375 | ![image](https://user-images.githubusercontent.com/91504420/210186306-69967771-293c-4b2c-8f8c-a2beb69b4e0a.png) 376 | 377 | ## Project 2️⃣4️⃣ -> Tindog Website 378 | 379 | ### about the project: 380 | 381 | tinder for dogs website with bootstrap html and css and python as backend. 382 | 383 | ### pictures of the project: 384 | 385 | ![image](https://user-images.githubusercontent.com/91504420/210186944-bcd8c53d-79bc-4cde-8234-567d4a07078a.png) 386 | 387 | ![image](https://user-images.githubusercontent.com/91504420/210187047-00b1c30b-f8b5-446a-a30b-c67962fc3f4d.png) 388 | 389 | ![image](https://user-images.githubusercontent.com/91504420/210187059-cd3d1307-4b7e-4f04-b4f5-9edfc9d86f31.png) 390 | 391 | ## Project 2️⃣5️⃣ -> Rock Paper Scissors Game 392 | 393 | ### about the project: 394 | 395 | classic terminal rock paper scissors game 396 | 397 | ### pictures of the project: 398 | 399 | ![image](https://user-images.githubusercontent.com/91504420/210187472-0eb18c24-0208-485b-8b2a-6368fc86782a.png) 400 | 401 |

(back to top)

402 | 403 | 404 | # :handshake: Contact 405 | 406 |

407 | liron_mizrahi 408 | liron.mizrhai1234 409 | 410 | liron LinkedIN 411 | 412 |

413 | 414 |

(back to top)

415 | 416 | 417 | # :gem: Acknowledgements 418 | 419 | Links to information that helped me during construction and learning: 420 | 421 | - [python3](https://docs.python.org/3/) 422 | - [BeautifulSoup](https://www.crummy.com/software/BeautifulSoup/bs4/doc/) 423 | - [Selenium Web Driver](https://www.selenium.dev/documentation/webdriver/) 424 | - [requests](https://requests.readthedocs.io/en/latest/) 425 | - [pandas](https://pandas.pydata.org/docs/) 426 | - [matplotlib](https://matplotlib.org/stable/index.html) 427 | - [tkinter](https://docs.python.org/3/library/tk.html) 428 | - [bootstrap](https://getbootstrap.com/docs/4.1/getting-started/introduction/) 429 | - [html](https://developer.mozilla.org/en-US/docs/Web/HTML) 430 | - [css](https://developer.mozilla.org/en-US/docs/Web/CSS) 431 | - [flask](https://flask.palletsprojects.com/en/2.2.x/) 432 | 433 |

(back to top)

434 | -------------------------------------------------------------------------------- /ascii_art.py: -------------------------------------------------------------------------------- 1 | rock = ''' 2 | _______ 3 | ---' ____) 4 | (_____) 5 | (_____) 6 | (____) 7 | ---.__(___) 8 | ''' 9 | 10 | paper = ''' 11 | _______ 12 | ---' ____)____ 13 | ______) 14 | _______) 15 | _______) 16 | ---.__________) 17 | ''' 18 | 19 | scissors = ''' 20 | _______ 21 | ---' ____)____ 22 | ______) 23 | __________) 24 | (____) 25 | ---.__(___) 26 | ''' 27 | -------------------------------------------------------------------------------- /calcluter.py: -------------------------------------------------------------------------------- 1 | # Python Calculator 2 | 3 | from tkinter import * 4 | 5 | root = Tk() 6 | root.geometry("500x500") 7 | root.resizable(0, 0) 8 | root.title('Python Calculator') 9 | 10 | expression = "" 11 | 12 | input_text = StringVar() 13 | 14 | # clear 15 | 16 | 17 | def btn_clear(): 18 | global expression 19 | expression = "" 20 | input_text.set("") 21 | 22 | # click 23 | 24 | 25 | def btn_click(item): 26 | global expression 27 | expression = expression + str(item) 28 | input_text.set(expression) 29 | 30 | # calculate 31 | 32 | 33 | def btn_equal(): 34 | global expression 35 | result = str(eval(expression)) 36 | input_text.set(result) 37 | expression = "" 38 | 39 | 40 | # input frame 41 | input_frame = Frame(root, width=312, height=50, bd=0, 42 | highlightbackground="black", highlightcolor="black", 43 | highlightthickness=2) 44 | 45 | input_frame.pack(side=TOP) 46 | 47 | # input field inside the frame 48 | input_field = Entry(input_frame, font=('arial', 18, 'bold'), 49 | textvariable=input_text, width=50, bg="#eee", bd=0, justify=RIGHT) 50 | 51 | input_field.grid(row=0, column=0) 52 | 53 | input_field.pack(ipady=10) 54 | 55 | # button frame 56 | btns_frame = Frame(root, width=312, height=272.5, bg="grey") 57 | 58 | btns_frame.pack() 59 | 60 | # first row 61 | clear = Button(btns_frame, text="CLEAR", fg="black", width=32, 62 | height=3, bd=0, bg="#eee", cursor="hand2", command=lambda: 63 | btn_clear()).grid(row=0, column=0, columnspan=3, padx=1, pady=1) 64 | divide = Button(btns_frame, text="/", fg="black", width=10, 65 | height=3, bd=0, bg="#eee", cursor="hand2", command=lambda: 66 | btn_click("/")).grid(row=0, column=3, padx=1, pady=1) 67 | 68 | # second row 69 | seven = Button(btns_frame, text="7", fg="black", width=10, 70 | height=3, bd=0, bg="#fff", cursor="hand2", command=lambda: 71 | btn_click(7)).grid(row=1, column=0, padx=1, pady=1) 72 | eight = Button(btns_frame, text="8", fg="black", width=10, 73 | height=3, bd=0, bg="#fff", cursor="hand2", command=lambda: 74 | btn_click(8)).grid(row=1, column=1, padx=1, pady=1) 75 | nine = Button(btns_frame, text="9", fg="black", width=10, height=3, bd=0, bg="#fff", cursor="hand2", command=lambda: 76 | btn_click(9)).grid(row=1, column=2, padx=1, pady=1) 77 | multiply = Button(btns_frame, text="*", fg="black", width=10, 78 | height=3, bd=0, bg="#eee", cursor="hand2", command=lambda: 79 | btn_click("*")).grid(row=1, column=3, padx=1, pady=1) 80 | 81 | # third row 82 | four = Button(btns_frame, text="4", fg="black", width=10, height=3, bd=0, bg="#fff", cursor="hand2", command=lambda: 83 | btn_click(4)).grid(row=2, column=0, padx=1, pady=1) 84 | five = Button(btns_frame, text="5", fg="black", width=10, height=3, bd=0, bg="#fff", cursor="hand2", command=lambda: 85 | btn_click(5)).grid(row=2, column=1, padx=1, pady=1) 86 | six = Button(btns_frame, text="6", fg="black", width=10, height=3, bd=0, bg="#fff", cursor="hand2", command=lambda: 87 | btn_click(6)).grid(row=2, column=2, padx=1, pady=1) 88 | minus = Button(btns_frame, text="-", fg="black", width=10, 89 | height=3, bd=0, bg="#eee", cursor="hand2", command=lambda: 90 | btn_click("-")).grid(row=2, column=3, padx=1, pady=1) 91 | 92 | # fourth row 93 | one = Button(btns_frame, text="1", fg="black", width=10, height=3, bd=0, bg="#fff", cursor="hand2", command=lambda: 94 | btn_click(1)).grid(row=3, column=0, padx=1, pady=1) 95 | two = Button(btns_frame, text="2", fg="black", width=10, height=3, bd=0, bg="#fff", cursor="hand2", command=lambda: 96 | btn_click(2)).grid(row=3, column=1, padx=1, pady=1) 97 | three = Button(btns_frame, text="3", fg="black", width=10, 98 | height=3, bd=0, bg="#fff", cursor="hand2", command=lambda: 99 | btn_click(3)).grid(row=3, column=2, padx=1, pady=1) 100 | plus = Button(btns_frame, text="+", fg="black", width=10, height=3, bd=0, bg="#eee", cursor="hand2", command=lambda: 101 | btn_click("+")).grid(row=3, column=3, padx=1, pady=1) 102 | 103 | # fourth row 104 | zero = Button(btns_frame, text="0", fg="black", width=21, height=3, bd=0, bg="#fff", cursor="hand2", command=lambda: 105 | btn_click(0)).grid(row=4, column=0, columnspan=2, padx=1, pady=1) 106 | point = Button(btns_frame, text=".", fg="black", width=10, 107 | height=3, bd=0, bg="#eee", cursor="hand2", command=lambda: 108 | btn_click(".")).grid(row=4, column=2, padx=1, pady=1) 109 | equals = Button(btns_frame, text="=", fg="black", width=10, 110 | height=3, bd=0, bg="#eee", cursor="hand2", command=lambda: 111 | btn_equal()).grid(row=4, column=3, padx=1, pady=1) 112 | 113 | root.mainloop() -------------------------------------------------------------------------------- /fizz_buzz_program/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/fizz_buzz_program/images/favicon.ico -------------------------------------------------------------------------------- /fizz_buzz_program/main.py: -------------------------------------------------------------------------------- 1 | import math 2 | import tkinter 3 | from tkinter import messagebox 4 | import threading 5 | 6 | # CONSTANTS 7 | 8 | FONT_NAME = "Courier" 9 | img_icon = "images/favicon.ico" 10 | 11 | 12 | def main(): 13 | # UI SETUP 14 | 15 | root = tkinter.Tk() 16 | root.title("Program Menu") 17 | root.config(padx=20, pady=20) 18 | root.geometry("600x250") 19 | root.bitmap(img_icon) 20 | root['background'] = '#FFF89C' 21 | 22 | # Labels 23 | 24 | root_label = tkinter.Label(root, text="Welcome to Liron Fizz Buzz Program", font=(FONT_NAME, 20), bg="#FFF89C") 25 | root_label.grid(column=0, row=0, columnspan="3") 26 | 27 | explanation_button = tkinter.Button(root, text="Program explanation", highlightthickness=0, width=20, bd="10", 28 | bg="#D75281", command=explanation_progra) 29 | explanation_button.grid(column=1, row=1, pady=30) 30 | 31 | play_button = tkinter.Button(root, text="Play", highlightthickness=0, width=20, bd="10", bg="#D75281",command=start_program) 32 | play_button.grid(column=1, row=2) 33 | 34 | root.mainloop() 35 | 36 | 37 | def start_program() -> None: 38 | global entry_number, output_label 39 | """ 40 | Start the program 41 | Parameters: None 42 | Returns: None 43 | """ 44 | second_root = tkinter.Toplevel() 45 | second_root.title(" Liron Buzz Program") 46 | second_root.iconbitmap(img_icon) 47 | second_root.geometry("600x300") 48 | second_root['background'] = '#CA955C' 49 | 50 | # Labels 51 | 52 | enter_num_label = tkinter.Label(second_root, text="Enter Number:", font=(FONT_NAME, 10), bg="#CA955C") 53 | enter_num_label.grid(column=0, row=0, columnspan="1") 54 | 55 | output_label = tkinter.Label(second_root, text=f"The numbers:", font=(FONT_NAME, 10), bg="#CA955C") 56 | output_label.grid(column=0, row=1, columnspan="1") 57 | 58 | # Entry 59 | 60 | entry_number = tkinter.Entry(second_root, width=20, selectborderwidth="5") 61 | entry_number.insert(tkinter.END, string="") 62 | entry_number.focus() 63 | entry_number.grid(column=1, row=0, columnspan=1, padx=20, pady=30) 64 | 65 | number_button = tkinter.Button(second_root, text="Send", highlightthickness=0, width=10, bd="10",bg="#EDDFB3", command=new_thread) 66 | number_button.grid(column=2, row=0, columnspan=1, padx=10, pady=30) 67 | 68 | 69 | def new_thread() -> None: 70 | global send_number 71 | """ 72 | Make new thread 73 | Parameters: None 74 | Returns: None 75 | """ 76 | thread1 = threading.Thread(target=send_number) 77 | thread1.start() 78 | 79 | def explanation_progra() -> None: 80 | """ 81 | Start the program 82 | Parameters: None 83 | Returns: None 84 | """ 85 | tkinter.messagebox.showinfo(title="Pogram Explanation", 86 | message="Hi, in this software you enter a number and it shows you which of the numbers from one to 10 is divided by it without a remainder, let's say 10, the result will be 1 2 5 and 10.") 87 | 88 | 89 | def send_number() -> None: 90 | global entry_number, output_label, send_number 91 | """ 92 | Get the number 93 | Parameters: None 94 | Returns: None 95 | """ 96 | arr_div_number = [] 97 | input_num = 5 98 | try: 99 | input_num = int(entry_number.get()) 100 | except ValueError: 101 | tkinter.messagebox.showerror(title="Input Error", message="Please enter number") 102 | 103 | if input_num < 0: 104 | tkinter.messagebox.showerror(title="Input Error", message="Please enter non negative number") 105 | elif input_num == 0: 106 | output_label.config(text=f"The numbers: {0}") 107 | else: 108 | for num in range(1, math.ceil(input_num / 2) + 2, 1): 109 | print(num) 110 | if input_num % num == 0: 111 | arr_div_number.append(num) 112 | arr_div_number.append(input_num) 113 | number_string = " ".join(str(e) for e in arr_div_number) 114 | as1 = number_string.split(" ") 115 | for i in range(0, len(as1), 5): 116 | as1[i] += '\n' 117 | number_string1 = " ".join(as1) 118 | output_label.config(text=f"The numbers: \n {number_string1}") 119 | 120 | 121 | if __name__ == "__main__": 122 | main() 123 | -------------------------------------------------------------------------------- /gender_age_guss_website/server.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | from flask import render_template 3 | import requests 4 | 5 | app = Flask(__name__) 6 | 7 | @app.route('/home') 8 | def home(): 9 | return render_template('index.html') 10 | 11 | 12 | @app.route('/home/guess/') 13 | def show_result(name: str) -> None: 14 | url_gender = f"https://api.genderize.io?name={name}" 15 | url_age =f"https://api.agify.io?name={name}" 16 | gender_data = requests.get(url_gender) 17 | age_data = requests.get(url_age) 18 | gender_user = gender_data.json()["gender"] 19 | age_user = age_data.json()["age"] 20 | if gender_user == "male" and int(age_user) > 50: 21 | return render_template('index1.html', name_user=name, gender=gender_user, age=age_user, gender_gif="https://media.giphy.com/media/ZjKPPIMAJ56UM/giphy.gif", age_gif="https://media.giphy.com/media/gv5JHx4troBPHOobKW/giphy.gif") 22 | elif gender_user == "male" and int(age_user) <= 50: 23 | return render_template('index1.html', name_user=name, gender=gender_user, age=age_user, gender_gif="https://media.giphy.com/media/ZjKPPIMAJ56UM/giphy.gif", age_gif="https://media.giphy.com/media/Kv4RBakx16vVifmjr6/giphy.gif") 24 | elif gender_user == "female" and int(age_user) > 50: 25 | return render_template('index1.html', name_user=name, gender=gender_user, age=age_user, gender_gif="https://media.giphy.com/media/3oKIPyRuDfitoVWPWE/giphy.gif", age_gif="https://media.giphy.com/media/akUKPkS4Bz7xc7jKTx/giphy.gif") 26 | elif gender_user == "female" and int(age_user) <= 50: 27 | return render_template('index1.html', name_user=name, gender=gender_user, age=age_user, gender_gif="https://media.giphy.com/media/3oKIPyRuDfitoVWPWE/giphy.gif", age_gif="https://giphy.com/clips/AnimationOnFOX-the-simpsons-fox-foxtv-qTG5qaFim8X9cw09SH") 28 | if __name__ == "__main__": 29 | app.run(debug=True) 30 | -------------------------------------------------------------------------------- /gender_age_guss_website/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Liron guess gender age website 6 | 7 | 8 |

Welcome to liron guess gender age program

9 | start image 10 | 11 | 15 | -------------------------------------------------------------------------------- /gender_age_guss_website/templates/index1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Liron guess gender age website 6 | 7 | 8 |

Hii, {{name_user}}

9 | start image 10 |

Your gender is {{gender}}

11 | start image 12 |

Your age is {{age}}

13 | start image 14 | 15 | 19 | -------------------------------------------------------------------------------- /higher-lower-site/__pycache__/server.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/higher-lower-site/__pycache__/server.cpython-310.pyc -------------------------------------------------------------------------------- /higher-lower-site/server.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | from flask import render_template 3 | import random 4 | 5 | app = Flask(__name__) 6 | 7 | random_number = random.randint(0, 9) 8 | 9 | 10 | @app.route('/') 11 | def hello_world(): 12 | return '

Guess a number between 0 and 9

start image ' 13 | print(random_number) 14 | 15 | 16 | @app.route('/') 17 | def show_result(num: int) -> None: 18 | if int(num) > random_number and int(num) < 10: 19 | return '

Your guess is to high

' 20 | elif int(num) < random_number and int(num) > -1: 21 | return '

Your guess is to low

' 22 | elif int(num) == random_number: 23 | return '

Your guess is good!!

' 24 | else: 25 | return '

you are try to hack liron higher lower site?

' 26 | 27 | 28 | 29 | if __name__ == "__main__": 30 | app.run(debug=True) 31 | -------------------------------------------------------------------------------- /kanye_quotes_program/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/kanye_quotes_program/background.png -------------------------------------------------------------------------------- /kanye_quotes_program/kanye.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/kanye_quotes_program/kanye.png -------------------------------------------------------------------------------- /kanye_quotes_program/main.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | import requests 3 | 4 | 5 | def main(): 6 | global canvas, quote_text 7 | 8 | window = tkinter.Tk() 9 | window.title("Kanye Says...") 10 | window.config(padx=50, pady=50) 11 | 12 | canvas = tkinter.Canvas(width=300, height=414) 13 | background_img = tkinter.PhotoImage(file="background.png") 14 | canvas.create_image(150, 207, image=background_img) 15 | quote_text = canvas.create_text(150, 207, text="Kanya quotes goes here", width=250, font=("Arial", 20, "bold"), fill="white") 16 | canvas.grid(row=0, column=0) 17 | 18 | kanye_img = tkinter.PhotoImage(file="kanye.png") 19 | kanye_button = tkinter.Button(image=kanye_img, highlightthickness=0, command=get_quote) 20 | kanye_button.grid(row=1, column=0) 21 | 22 | window.mainloop() 23 | 24 | 25 | def get_quote(): 26 | global canvas, quote_text 27 | response = requests.get(url="https://api.kanye.rest") 28 | print(response) 29 | response.raise_for_status() 30 | data = response.json() 31 | quote = data["quote"] 32 | canvas.itemconfig(quote_text, text=quote) 33 | 34 | 35 | if __name__ == "__main__": 36 | main() 37 | -------------------------------------------------------------------------------- /liron_blog_website/__pycache__/post.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/liron_blog_website/__pycache__/post.cpython-310.pyc -------------------------------------------------------------------------------- /liron_blog_website/main.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template 2 | from post import Post 3 | import requests 4 | 5 | posts = requests.get("https://api.npoint.io/457d7b319455edb57e4d").json() 6 | post_objects = [] 7 | for post in posts: 8 | post_obj = Post(post["id"], post["title"], post["subtitle"], post["body"]) 9 | post_objects.append(post_obj) 10 | 11 | app = Flask(__name__) 12 | 13 | 14 | @app.route('/') 15 | def get_all_posts(): 16 | return render_template("index.html", all_posts=post_objects) 17 | 18 | 19 | @app.route("/post/") 20 | def show_post(index): 21 | requested_post = None 22 | for blog_post in post_objects: 23 | if blog_post.id == index: 24 | requested_post = blog_post 25 | return render_template("post.html", post=requested_post) 26 | 27 | 28 | if __name__ == "__main__": 29 | app.run(debug=True) -------------------------------------------------------------------------------- /liron_blog_website/post.py: -------------------------------------------------------------------------------- 1 | class Post: 2 | def __init__(self, post_id, title, subtitle, body): 3 | self.id = post_id 4 | self.title = title 5 | self.subtitle = subtitle 6 | self.body = body -------------------------------------------------------------------------------- /liron_blog_website/static/css/styles.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background: #efeff3; 3 | margin: 0; 4 | font-family: 'Raleway', sans-serif; 5 | -webkit-font-smoothing: antialiased; 6 | color:#212121; 7 | } 8 | .wrapper{ 9 | position: relative; 10 | clear:both; 11 | margin: 0 auto 75px auto; 12 | width: 100%; 13 | overflow: hidden; 14 | } 15 | .top{ 16 | background: #4e89ae; 17 | height: 180px; 18 | border-top: 20px solid #43658b; 19 | } 20 | 21 | .top .title { 22 | width: 700px; 23 | margin: 38px auto 0 auto; 24 | } 25 | 26 | .title h1 { 27 | font-size:24px; 28 | color:#FFF; 29 | font-weight:500; 30 | } 31 | 32 | .content{ 33 | margin: -80px auto 100px; 34 | padding-bottom: 20px; 35 | } 36 | 37 | .card{ 38 | position: relative; 39 | background: #fff; 40 | padding:50px; 41 | width: 600px; 42 | margin: 20px auto 0 auto; 43 | box-shadow: 0 2px 4px rgba(100,100,100,.1); 44 | } 45 | 46 | .card h2 { 47 | font-size:21px; 48 | font-weight:500; 49 | } 50 | 51 | .card h2 a { 52 | color:#CC0000; 53 | text-decoration:none; 54 | } 55 | 56 | .card .text { 57 | color:#212121; 58 | margin-top:20px; 59 | font-size:15px; 60 | line-height:22px; 61 | } 62 | 63 | footer { 64 | position: fixed; 65 | left: 0; 66 | bottom: 0; 67 | width: 100%; 68 | background-color: #43658b; 69 | color: white; 70 | text-align: center; 71 | } -------------------------------------------------------------------------------- /liron_blog_website/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 |
11 |
12 |

Liron Blog

13 |
14 | 15 | {% for post in all_posts: %} 16 |
17 |
18 |

{{ post.title }}

19 |

{{ post.subtitle }}

20 | Read 21 |
22 | 23 |
24 | {% endfor %} 25 | 26 |
27 | 28 |
29 |

Made with ♥️ in Israel.

30 |
31 | -------------------------------------------------------------------------------- /liron_blog_website/templates/post.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Liron blog website 6 | 7 | 8 | 9 | 10 |
11 |
12 |

Liron Blog

13 |
14 |
15 |
16 |

{{ post.title }}

17 |

{{ post.subtitle }}

18 |

{{ post.body }}

19 |
20 |
21 |
22 | 23 |
24 |

Made with ♥️ in Israel.

25 |
26 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import random 2 | from ascii_art import rock, paper, scissors 3 | def main(): 4 | print(f"welcome to liron rock paper scissors game! \U0001F604") 5 | game_images = [rock, paper, scissors] 6 | user_choice = int(input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors.\n")) 7 | if user_choice >= 3 or user_choice < 0: 8 | print("You typed an invalid number, you lose!") 9 | else: 10 | print(game_images[user_choice]) 11 | computer_choice = random.randint(0, 2) 12 | print("Computer chose:") 13 | print(game_images[computer_choice]) 14 | victory_check(user_choice, computer_choice) 15 | 16 | def victory_check(user_choice: int, computer_choice: int) -> None: 17 | """ 18 | chack whe is won the game 19 | Input: user_choice: int, computer_choice: int 20 | Returns: None 21 | """ 22 | if user_choice == 0 and computer_choice == 2: 23 | print("You win!") 24 | elif computer_choice == 0 and user_choice == 2: 25 | print("You lose") 26 | elif computer_choice > user_choice: 27 | print("You lose") 28 | elif user_choice > computer_choice: 29 | print("You win!") 30 | elif computer_choice == user_choice: 31 | print("It's a draw") 32 | 33 | if __name__ == "__main__": 34 | main() 35 | -------------------------------------------------------------------------------- /math_program/images/cheat_sheet-modified1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/math_program/images/cheat_sheet-modified1.png -------------------------------------------------------------------------------- /math_program/images/cos-modified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/math_program/images/cos-modified.png -------------------------------------------------------------------------------- /math_program/images/def_limt1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/math_program/images/def_limt1.png -------------------------------------------------------------------------------- /math_program/images/def_limt2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/math_program/images/def_limt2.png -------------------------------------------------------------------------------- /math_program/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/math_program/images/favicon.ico -------------------------------------------------------------------------------- /math_program/images/integral2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/math_program/images/integral2.png -------------------------------------------------------------------------------- /math_program/images/lim_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/math_program/images/lim_icon.png -------------------------------------------------------------------------------- /math_program/images/send-modified1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/math_program/images/send-modified1.png -------------------------------------------------------------------------------- /math_program/images/sin-modified1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/math_program/images/sin-modified1.png -------------------------------------------------------------------------------- /math_program/images/tan-modified1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/math_program/images/tan-modified1.png -------------------------------------------------------------------------------- /math_program/images/trig-modified1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/math_program/images/trig-modified1.png -------------------------------------------------------------------------------- /math_program/images/trig_banner3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/math_program/images/trig_banner3.png -------------------------------------------------------------------------------- /math_program/main.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | import threading 3 | import numpy as np 4 | import sympy 5 | from matplotlib import pyplot as plt 6 | import math 7 | from PIL import ImageTk, Image 8 | from tkinter import ttk, messagebox, filedialog 9 | from tkVideoPlayer import TkinterVideo 10 | from sympy import limit, Symbol 11 | from sympy import init_printing 12 | 13 | 14 | img_icon = "images/favicon.ico" 15 | math_icon = "images/math-modified1.png" 16 | FONT_NAME = "Courier" 17 | trig_image = "images/trig-modified1.png" 18 | lim_image = "images/lim_icon.png" 19 | trig_banner = "images/trig_banner3.png" 20 | cos_img = "images/cos-modified.png" 21 | send_img = "images/send-modified1.png" 22 | cheat_sheet = "images/cheat_sheet-modified1.png" 23 | lim_img = "images/def_limt2.png" 24 | integral_img = "images/integral2.png" 25 | 26 | init_printing() 27 | 28 | 29 | def main(): 30 | # UI SETUP 31 | 32 | root = tkinter.Tk() 33 | root.title("Liron Math Program") 34 | root.config(padx=20, pady=20) 35 | root.geometry("950x650") 36 | root.iconbitmap(img_icon) 37 | root['background'] = '#E4DCCF' 38 | 39 | # Canvas 40 | 41 | canvas_logo = tkinter.Canvas(root, width=60, height=60, highlightthickness=0, bg="#E4DCCF") 42 | logo_img = tkinter.PhotoImage(file=math_icon) 43 | canvas_logo.create_image(30, 30, image=logo_img) 44 | canvas_logo.place(x=460, y=10) 45 | 46 | canvas_menue = tkinter.Canvas(root, width=870, height=500, highlightthickness=0, bg="#7D9D9C") 47 | trig_img = tkinter.PhotoImage(file=trig_image) 48 | lim_img = tkinter.PhotoImage(file=lim_image) 49 | integral_img1 = tkinter.PhotoImage(file=integral_img) 50 | canvas_menue.place(x=20, y=100) 51 | 52 | # Labels 53 | 54 | root_label = tkinter.Label(root, text="Welcome to Liron", font=("Helvetica", 35, "bold"), bg="#E4DCCF") 55 | root_label.place(x=20, y=10) 56 | 57 | root_label1 = tkinter.Label(root, text="Math Program", font=("Helvetica", 35, "bold"), bg="#E4DCCF") 58 | root_label1.place(x=570, y=10) 59 | 60 | trig_label = tkinter.Label(root, text="Trig World", fg="#05595B", font=("Helvetica", 20, "bold"), bg="#7D9D9C") 61 | trig_label.place(x=140, y=145) 62 | 63 | lim_label = tkinter.Label(root, text="Limits World", fg="#05595B", font=("Helvetica", 20, "bold"), bg="#7D9D9C") 64 | lim_label.place(x=140, y=210) 65 | 66 | integral_label = tkinter.Label(root, text="Integral World", fg="#05595B", font=("Helvetica", 20, "bold"), 67 | bg="#7D9D9C") 68 | integral_label.place(x=140, y=280) 69 | 70 | # Buttons 71 | 72 | trig_button = tkinter.Button(root, image=trig_img, highlightthickness=0, width=60, bg="#7D9D9C", 73 | command=trig_window) 74 | trig_button.place(x=60, y=130) 75 | 76 | lim_button = tkinter.Button(root, image=lim_img, highlightthickness=0, width=60, bg="#7D9D9C", 77 | command=lim_window) 78 | lim_button.place(x=60, y=200) 79 | 80 | integral_button = tkinter.Button(root, image=integral_img1, highlightthickness=0, width=60, bg="#7D9D9C", 81 | command=integral_window) 82 | integral_button.place(x=60, y=270) 83 | 84 | root.mainloop() 85 | 86 | 87 | def trig_window() -> None: 88 | """ 89 | Start the trig window 90 | Parameters: None 91 | Returns: None 92 | """ 93 | global trig_banner_image, send1_img, videoplayer, entry_angle_input, trig_root, radian_label, cheat_sheet1, entry_engle_input1, show_function_value 94 | 95 | trig_root = tkinter.Toplevel() 96 | trig_root.title(" Trig World") 97 | trig_root.iconbitmap(img_icon) 98 | trig_root.geometry("800x600") 99 | trig_root.iconbitmap(img_icon) 100 | trig_root['background'] = '#ECB390' 101 | 102 | trig_banner_image = ImageTk.PhotoImage(Image.open(trig_banner)) 103 | send1_img = ImageTk.PhotoImage(Image.open(send_img)) 104 | cheat_sheet1 = ImageTk.PhotoImage(Image.open(cheat_sheet)) 105 | trig_root_label = tkinter.Label(trig_root, image=trig_banner_image) 106 | trig_root_label.place(x=0, y=0) 107 | 108 | vlist = ["cos", "sin", "tan", 109 | "cosh", "sinh", "arccos", "arcsin", "arctan"] 110 | 111 | Combo_func = tkinter.ttk.Combobox(trig_root, values=vlist) 112 | Combo_func.set("Pick an Function") 113 | Combo_func.place(x=40, y=330) 114 | 115 | pick_trig_function = tkinter.Label(trig_root, 116 | text="Enter a b and c and pick a graph \nthe parmeters is like this A*fun(B*x) + C \n when finish press send button", 117 | font=("Helvetica", 8, "bold"), bg="#ECB390") 118 | pick_trig_function.place(x=1, y=270) 119 | 120 | # Entry 121 | 122 | entry_a_input = tkinter.Entry(trig_root, width=23) 123 | entry_a_input.insert(tkinter.END, string="Enter A:") 124 | entry_a_input.place(x=40, y=370) 125 | 126 | entry_b_input = tkinter.Entry(trig_root, width=23) 127 | entry_b_input.insert(tkinter.END, string="Enter B:") 128 | entry_b_input.place(x=40, y=400) 129 | 130 | entry_c_input = tkinter.Entry(trig_root, width=23) 131 | entry_c_input.insert(tkinter.END, string="Enter C:") 132 | entry_c_input.place(x=40, y=430) 133 | 134 | send_button = tkinter.Button(trig_root, image=send1_img, highlightthickness=0, width=60, bg="#ECB390", 135 | command=lambda: send_graph_data(Combo_func.get(), entry_a_input.get(), 136 | entry_b_input.get(), entry_c_input.get())) 137 | send_button.place(x=80, y=485) 138 | 139 | play_button = tkinter.Button(trig_root, text="play trig video", highlightthickness=0, width=21, bg="#ECB390", 140 | command=play_trig) 141 | play_button.place(x=600, y=270) 142 | 143 | pause_button = tkinter.Button(trig_root, text="pause trig video", highlightthickness=0, width=21, bg="#ECB390", 144 | command=pause_trig) 145 | pause_button.place(x=600, y=300) 146 | 147 | videoplayer = TkinterVideo(master=trig_root, scaled=True) 148 | videoplayer.load(r"trig (1).mp4") 149 | videoplayer.place(x=600, y=330) 150 | 151 | entry_angle_input = tkinter.Entry(trig_root, width=24) 152 | entry_angle_input.insert(tkinter.END, string="Enter angle:") 153 | entry_angle_input.place(x=600, y=450) 154 | 155 | send1_button = tkinter.Button(trig_root, text="Send", highlightthickness=0, width=20, bg="#ECB390", 156 | command=convert_radian) 157 | send1_button.place(x=600, y=485) 158 | 159 | radian_label = tkinter.Label(trig_root, text="engle is a num in radian.", 160 | font=("Helvetica", 10, "bold"), bg="#ECB390") 161 | 162 | cheat_sheet_button = tkinter.Button(trig_root, image=cheat_sheet1, highlightthickness=0, width=60, bg="#ECB390", 163 | command=open_file_root) 164 | cheat_sheet_button.place(x=380, y=270) 165 | 166 | # Entry 167 | 168 | entry_engle_input1 = tkinter.Entry(trig_root, width=15) 169 | entry_engle_input1.insert(tkinter.END, string="Enter angle:") 170 | entry_engle_input1.place(x=365, y=350) 171 | 172 | send2_button = tkinter.Button(trig_root, text="Send angle", highlightthickness=0, width=15, bg="#ECB390", 173 | command=show_value_function) 174 | send2_button.place(x=355, y=400) 175 | 176 | show_function_value = tkinter.Label(trig_root, text="", font=("Helvetica", 10, "bold"), bg="#ECB390") 177 | show_function_value.place(x=360, y=430) 178 | 179 | 180 | def integral_window() -> None: 181 | """ 182 | Start the integral window 183 | Parameters: None 184 | Returns: None 185 | """ 186 | global img_icon, cheat_sheet1, cheat_sheet, insert_label1, send_img, send1_img, entry_function_input1, start_x, end_x 187 | intgral_root = tkinter.Toplevel() 188 | intgral_root.title("integral window world") 189 | intgral_root.iconbitmap(img_icon) 190 | intgral_root.geometry("1000x600") 191 | send1_img = ImageTk.PhotoImage(Image.open(send_img)) 192 | intgral_root.iconbitmap(img_icon) 193 | intgral_root['background'] = '#3F4E4F' 194 | cheat_sheet1 = ImageTk.PhotoImage(Image.open(cheat_sheet)) 195 | cheat_sheet_button = tkinter.Button(intgral_root, image=cheat_sheet1, highlightthickness=0, width=60, bg="#3F4E4F", 196 | command=open_file_root) 197 | cheat_sheet_button.place(x=890, y=80) 198 | 199 | weclome_lim_label = tkinter.Label(intgral_root, text="welcome to liron integral world", font=("Modern", 35, "bold"), 200 | bg="#3F4E4F") 201 | weclome_lim_label.place(x=230, y=10) 202 | 203 | insert_integral_label = tkinter.Label(intgral_root, 204 | text="Enter function you want to integrate: \n and ** is ^ exp is e and log is ln \n if you want definte integral enter the start x and end x if no dont fil them ", 205 | font=("Modern", 15, "bold"), bg="#3F4E4F") 206 | insert_integral_label.place(x=20, y=80) 207 | 208 | entry_function_input1 = tkinter.Entry(intgral_root, width=24) 209 | entry_function_input1.insert(tkinter.END, string="f(x) = ") 210 | entry_function_input1.place(x=40, y=180) 211 | 212 | start_x = tkinter.Entry(intgral_root, width=24) 213 | start_x.insert(tkinter.END, string="start x:") 214 | start_x.place(x=40, y=210) 215 | 216 | end_x = tkinter.Entry(intgral_root, width=24) 217 | end_x.insert(tkinter.END, string="end x:") 218 | end_x.place(x=40, y=240) 219 | 220 | send_data_button1 = tkinter.Button(intgral_root, image=send1_img, highlightthickness=0, width=60, bg="#3F4E4F", 221 | command=calculate_integral) 222 | send_data_button1.place(x=80, y=280) 223 | 224 | insert_label1 = tkinter.Label(intgral_root, text="", font=("Modern", 15, "bold"), bg="#3F4E4F") 225 | insert_label1.place(x=15, y=350) 226 | 227 | 228 | def calculate_integral() -> None: 229 | """ 230 | calculate the integral of the user 231 | Parameters: None 232 | Returns: None 233 | """ 234 | global insert_label1, entry_function_input1, start_x, end_x 235 | x = Symbol('x') 236 | try: 237 | float(start_x.get()) 238 | float(end_x.get()) 239 | f = entry_function_input1.get() 240 | integral1 = sympy.integrate(f, (x, float(start_x.get()), float(end_x.get()))).simplify() 241 | insert_label1.config( 242 | text=f"the output of {entry_function_input1.get()} from {float(start_x.get())} to {float(end_x.get())} is {integral1}") 243 | except ValueError: 244 | f = entry_function_input1.get() 245 | try: 246 | integral = sympy.integrate(f, x).simplify() 247 | insert_label1.config(text=f"the integral of {entry_function_input1.get()} is {integral} + c") 248 | except: 249 | tkinter.messagebox.showerror(title="Bad input", message="enter the function and the Arithmetic ") 250 | 251 | 252 | def lim_window() -> None: 253 | """ 254 | Start the limit window 255 | Parameters: None 256 | Returns: None 257 | """ 258 | global img_icon, cheat_sheet1, send1_img, send_img, entry_point_input, entry_function_input, insert_label, lim_def_img 259 | lim_root = tkinter.Toplevel() 260 | lim_root.title(" lim World") 261 | lim_root.iconbitmap(img_icon) 262 | lim_root.geometry("800x600") 263 | lim_root.iconbitmap(img_icon) 264 | lim_root['background'] = '#607EAA' 265 | cheat_sheet1 = ImageTk.PhotoImage(Image.open(cheat_sheet)) 266 | lim_def_img = ImageTk.PhotoImage(Image.open(lim_img)) 267 | cheat_sheet_button = tkinter.Button(lim_root, image=cheat_sheet1, highlightthickness=0, width=60, bg="#607EAA", 268 | command=open_file_root) 269 | cheat_sheet_button.place(x=690, y=80) 270 | 271 | send1_img = ImageTk.PhotoImage(Image.open(send_img)) 272 | 273 | weclome_lim_label = tkinter.Label(lim_root, text="welcome to liron limit world", font=("Terminal", 25, "bold"), 274 | bg="#607EAA") 275 | weclome_lim_label.place(x=50, y=10) 276 | 277 | insert_label = tkinter.Label(lim_root, 278 | text="Enter function and the point you want to calclute the lim for \n if you want infinty write oo:", 279 | font=("Terminal", 9, "bold"), 280 | bg="#607EAA") 281 | insert_label.place(x=20, y=80) 282 | 283 | entry_function_input = tkinter.Entry(lim_root, width=24) 284 | entry_function_input.insert(tkinter.END, string="f(x) = ") 285 | entry_function_input.place(x=20, y=150) 286 | 287 | entry_point_input = tkinter.Entry(lim_root, width=24) 288 | entry_point_input.insert(tkinter.END, string="x = ") 289 | entry_point_input.place(x=20, y=190) 290 | 291 | send_data_button = tkinter.Button(lim_root, image=send1_img, highlightthickness=0, width=60, bg="#607EAA", 292 | command=calclute_limit) 293 | send_data_button.place(x=40, y=220) 294 | 295 | insert_label = tkinter.Label(lim_root, text="", font=("Terminal", 9, "bold"), bg="#607EAA") 296 | insert_label.place(x=15, y=290) 297 | 298 | limit_label = tkinter.Label(lim_root, text="Limit Definition", font=("Terminal", 14, "bold"), bg="#607EAA") 299 | limit_label.place(x=460, y=170) 300 | 301 | canvas_limit = tkinter.Canvas(lim_root, width=500, height=600, highlightthickness=0, bg="#607EAA") 302 | canvas_limit.create_image(250, 200, image=lim_def_img) 303 | canvas_limit.place(x=290, y=200) 304 | 305 | 306 | def calclute_limit() -> None: 307 | """ 308 | calclute the limit and show the graph 309 | Parameters: None 310 | Returns: None 311 | """ 312 | global entry_point_input, entry_function_input, insert_label 313 | x = Symbol('x') 314 | y = entry_function_input.get() 315 | point = entry_point_input.get() 316 | try: 317 | lim = limit(y, x, point) 318 | insert_label.config(text=f"the lim of the {y}\nin the point {point} is\n{lim}") 319 | except: 320 | tkinter.messagebox.showerror(title="Bad input", message="enter the function and the Arithmetic ") 321 | 322 | 323 | def show_value_function() -> None: 324 | """ 325 | update the show function value to the screen in trig root 326 | Parameters: None 327 | Returns: None 328 | """ 329 | global entry_engle_input1, trig_root, show_function_value 330 | try: 331 | float(entry_engle_input1.get()) 332 | tkinter.Label.config(show_function_value, 333 | text=f"cos is {round(math.cos(float(entry_engle_input1.get()) * (math.pi / 180)), 2)} \n sin is {round(math.sin(float(entry_engle_input1.get()) * (math.pi / 180)), 2)} \n tan is {round(math.tan(float(entry_engle_input1.get()) * (math.pi / 180)), 2)}") 334 | except ValueError: 335 | tkinter.messagebox.showerror(title="Bed Input", message="Enter number please!") 336 | 337 | 338 | def open_file_root() -> None: 339 | """ 340 | Open file root gui 341 | Parameters: None 342 | Returns: None 343 | """ 344 | global file_root, text, img_icon 345 | file_root = tkinter.Tk() 346 | # Set the Geometry 347 | file_root.geometry("680x520") 348 | file_root.title("Liron Cheat Sheets") 349 | file_root.iconbitmap(img_icon) 350 | file_root['background'] = '#354259' 351 | text = tkinter.Text(file_root, width=80, height=30) 352 | text.place(x=20, y=20) 353 | 354 | # Create a Menu 355 | my_menu = tkinter.Menu(file_root) 356 | file_root.config(menu=my_menu) 357 | # Add dropdown to the Menus 358 | file_menu = tkinter.Menu(my_menu, tearoff=False) 359 | 360 | my_menu.add_cascade(label="File", menu=file_menu) 361 | file_menu.add_command(label="Open", command=open_file) 362 | file_menu.add_command(label="Clear", command=clear_text) 363 | file_menu.add_command(label="Quit", command=quit_file_root) 364 | 365 | 366 | def quit_file_root() -> None: 367 | """ 368 | quit the file root 369 | Parameters: None 370 | Returns: None 371 | """ 372 | global file_root 373 | file_root.destroy() 374 | 375 | 376 | def open_file() -> None: 377 | """ 378 | Open the pdf file 379 | Parameters: None 380 | Returns: None 381 | """ 382 | file_name = filedialog.askopenfilename( 383 | initialdir=r'\math_cheat_sheet' 384 | , title="cheat sheets", 385 | filetypes=(("txt files", "*.txt"),)) 386 | if file_name: 387 | txt_file = file_name 388 | with open(txt_file, encoding="utf8") as file: 389 | text1 = file.read() 390 | # Select a Page to read 391 | # Add the content to TextBox 392 | text.insert(1.0, text1) 393 | 394 | 395 | def clear_text() -> None: 396 | """ 397 | clear the text of the file 398 | Parameters: None 399 | Returns: None 400 | """ 401 | global text 402 | text.delete(1.0, tkinter.END) 403 | 404 | 405 | def convert_radian() -> None: 406 | """ 407 | Convert angle input to radian and show to user 408 | Parameters: None 409 | Returns: None 410 | """ 411 | global entry_angle_input, trig_root, radian_label 412 | try: 413 | float(entry_angle_input.get()) 414 | radian = float(entry_angle_input.get()) * (math.pi / 180) 415 | tkinter.Label.config(radian_label, text=f"{entry_angle_input.get()} is a {radian} in radian.") 416 | radian_label.place(x=550, y=550) 417 | except ValueError: 418 | tkinter.messagebox.showerror(title="Bed Input", message="Enter number please!") 419 | 420 | 421 | def play_trig() -> None: 422 | """ 423 | Play the trig video in the trig window 424 | Parameters: None 425 | Returns: None 426 | """ 427 | global videoplayer 428 | videoplayer.play() # play the video 429 | 430 | 431 | def pause_trig() -> None: 432 | """ 433 | Pause the video in the trig window 434 | Parameters: None 435 | Returns: None 436 | """ 437 | global videoplayer 438 | videoplayer.pause() # play the video 439 | 440 | 441 | def send_graph_data(graph: str, a: float, b: float, c: float) -> None: 442 | """ 443 | check user data and send to make graph 444 | Parameters: None 445 | Returns: None 446 | """ 447 | if graph == "sin" or graph == "cos" or graph == "tan" or graph == "cosh" or graph == "sinh" or graph == "arccos" or graph == "arcsin" or graph == "arctan": 448 | try: 449 | float(a) 450 | float(b) 451 | float(c) 452 | if graph == "cos": 453 | make_cos_graph(float(a), float(b), float(c)) 454 | elif graph == "sin": 455 | make_sin_graph(float(a), float(b), float(c)) 456 | elif graph == "tan": 457 | make_tan_graph(float(a), float(b), float(c)) 458 | elif graph == "cosh": 459 | make_cosh_graph(float(a), float(b), float(c)) 460 | elif graph == "sinh": 461 | make_sinh_graph(float(a), float(b), float(c)) 462 | elif graph == "arccos": 463 | make_arccos_graph(float(a), float(b), float(c)) 464 | elif graph == "arcsin": 465 | make_arcsin_graph(float(a), float(b), float(c)) 466 | else: 467 | make_arctan_graph(float(a), float(b), float(c)) 468 | 469 | except ValueError: 470 | tkinter.messagebox.showerror(title="Bed Input", message="please enter numbers for A, B and C") 471 | else: 472 | tkinter.messagebox.showerror(title="Bed Input", message="please chose function!") 473 | 474 | 475 | def make_cos_graph(a: float, b: float, c: float) -> None: 476 | """ 477 | Make and show to the screen the cos graph 478 | Parameters: None 479 | Returns: None 480 | """ 481 | 482 | x = np.arange(-10 * np.pi, 10 * np.pi, 0.01) # start,stop,step 483 | z = a * np.cos(b * x) + c 484 | 485 | plt.plot(x, z) 486 | plt.xlabel('x values from -10pi to 10pi') # string must be enclosed with quotes ' ' 487 | plt.ylabel('cos') 488 | plt.title('Plot of cos from -10pi to 10pi') 489 | plt.legend(['cos(x)']) # legend entries as seperate strings in a list 490 | plt.show() 491 | 492 | 493 | def make_sin_graph(a: float, b: float, c: float) -> None: 494 | """ 495 | Make and show to the screen the sin graph 496 | Parameters: None 497 | Returns: None 498 | """ 499 | 500 | x = np.arange(-10 * np.pi, 10 * np.pi, 0.01) # start,stop,step 501 | z = a * np.sin(b * x) + c 502 | 503 | plt.plot(x, z) 504 | plt.xlabel('x values from -10pi to 10pi') # string must be enclosed with quotes ' ' 505 | plt.ylabel('sin') 506 | plt.title('Plot of sin from -10pi to 10pi') 507 | plt.legend(['sin(x)']) # legend entries as seperate strings in a list 508 | plt.show() 509 | 510 | 511 | def make_tan_graph(a: float, b: float, c: float) -> None: 512 | """ 513 | Make and show to the screen the tan graph 514 | Parameters: None 515 | Returns: None 516 | """ 517 | 518 | x = np.linspace(-10 * np.pi, 10 * np.pi, 1000) 519 | plt.plot(x, a * np.tan(b * x) + c) 520 | plt.ylim(-5, 5) 521 | plt.xlabel('x values from -10pi to 10pi') # string must be enclosed with quotes ' ' 522 | plt.ylabel('tan') 523 | plt.title('Plot of tan from -10pi to 10pi') 524 | plt.legend(['tan(x)']) # legend entries as seperate strings in a list 525 | plt.show() 526 | 527 | 528 | def make_cosh_graph(a: float, b: float, c: float) -> None: 529 | """ 530 | Make and show to the screen the cosh graph 531 | Parameters: None 532 | Returns: None 533 | """ 534 | 535 | x = np.arange(-10 * np.pi, 10 * np.pi, 0.01) # start,stop,step 536 | z = a * np.cosh(b * x) + c 537 | 538 | plt.plot(x, z) 539 | plt.xlabel('x values from -10pi to 10pi') # string must be enclosed with quotes ' ' 540 | plt.ylabel('cosh') 541 | plt.title('Plot of cosh from -10pi to 10pi') 542 | plt.legend(['cosh(x)']) # legend entries as seperate strings in a list 543 | plt.show() 544 | 545 | 546 | def make_sinh_graph(a: float, b: float, c: float) -> None: 547 | """ 548 | Make and show to the screen the sinh graph 549 | Parameters: None 550 | Returns: None 551 | """ 552 | 553 | x = np.arange(-10 * np.pi, 10 * np.pi, 0.01) # start,stop,step 554 | z = a * np.sinh(b * x) + c 555 | 556 | plt.plot(x, z) 557 | plt.xlabel('x values from -10pi to 10pi') # string must be enclosed with quotes ' ' 558 | plt.ylabel('sinh') 559 | plt.title('Plot of sinh from -10pi to 10pi') 560 | plt.legend(['sinh(x)']) # legend entries as seperate strings in a list 561 | plt.show() 562 | 563 | 564 | def make_arccos_graph(a: float, b: float, c: float) -> None: 565 | """ 566 | Make and show to the screen the arccos graph 567 | Parameters: None 568 | Returns: None 569 | """ 570 | 571 | x = np.arange(-10 * np.pi, 10 * np.pi, 0.01) # start,stop,step 572 | z = a * np.arccos(b * x) + c 573 | 574 | plt.plot(x, z) 575 | plt.xlabel('x values from -10pi to 10pi') # string must be enclosed with quotes ' ' 576 | plt.ylabel('arccos') 577 | plt.title('Plot of arccos from -10pi to 10pi') 578 | plt.legend(['arccos(x)']) # legend entries as seperate strings in a list 579 | plt.show() 580 | 581 | 582 | def make_arcsin_graph(a: float, b: float, c: float) -> None: 583 | """ 584 | Make and show to the screen the arcsin graph 585 | Parameters: None 586 | Returns: None 587 | """ 588 | 589 | x = np.arange(-10 * np.pi, 10 * np.pi, 0.01) # start,stop,step 590 | z = a * np.arcsin(b * x) + c 591 | 592 | plt.plot(x, z) 593 | plt.xlabel('x values from -10pi to 10pi') # string must be enclosed with quotes ' ' 594 | plt.ylabel('arcsin') 595 | plt.title('Plot of arcsin from -10pi to 10pi') 596 | plt.legend(['arcsin(x)']) # legend entries as seperate strings in a list 597 | plt.show() 598 | 599 | 600 | def make_arctan_graph(a: float, b: float, c: float) -> None: 601 | """ 602 | Make and show to the screen the arctan graph 603 | Parameters: None 604 | Returns: None 605 | """ 606 | 607 | x = np.arange(-10 * np.pi, 10 * np.pi, 0.01) # start,stop,step 608 | z = a * np.arctan(b * x) + c 609 | plt.plot(x, z) 610 | plt.xlabel('x values from -10pi to 10pi') # string must be enclosed with quotes ' ' 611 | plt.ylabel('arctan') 612 | plt.title('Plot of arctan from -10pi to 10pi') 613 | plt.legend(['arctan(x)']) # legend entries as seperate strings in a list 614 | plt.show() 615 | 616 | 617 | if __name__ == "__main__": 618 | main() 619 | -------------------------------------------------------------------------------- /math_program/math_cheat_sheet/integral.txt: -------------------------------------------------------------------------------- 1 | liron integral cheat sheet 2 | 3 | 4 | integral of x is x^2 /2 + c 5 | 6 | integral of number is number * x + c 7 | 8 | integral of x^n = x^(n+ 1)/n + 1 + c 9 | 10 | integral of e^(a*x) = e^(a*x) / a + c 11 | 12 | integral of cos = sin + c 13 | 14 | integral of sin = - cos + c -------------------------------------------------------------------------------- /math_program/math_cheat_sheet/lim.txt: -------------------------------------------------------------------------------- 1 | liron lim cheat sheet 2 | 3 | special limits 4 | 5 | sin(x)/x = 1, x -> 0 6 | 7 | (1-cos(x))/x = 0, x-> 0 8 | 9 | (1+x)^(1/x) = e, x-> 0 10 | 11 | (1+1/x)^x = e, x -> oo 12 | 13 | (1+k/x)^x = e^k, x-> oo 14 | 15 | sin^-1 /x = 1, x -> 0 16 | 17 | sinx/x = 1, x -> 0 18 | 19 | tanx/x = 1, x-> 0 -------------------------------------------------------------------------------- /math_program/math_cheat_sheet/liron.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/math_program/math_cheat_sheet/liron.txt -------------------------------------------------------------------------------- /math_program/math_cheat_sheet/trig.txt: -------------------------------------------------------------------------------- 1 | liron trig cheat sheet 2 | 3 | Right triangle definition 4 | 5 | sin = opposite/hypotenuse 6 | cos = adjacent/hypotenuse 7 | tan = opposite/adjacent 8 | csc = hypotenuse/opposit 9 | sec = hypotenuse/adjacent 10 | cot = adjacent/opposit 11 | 12 | Unit circle definition 13 | 14 | sin = y 15 | cos = x 16 | tan = y/x 17 | csc = 1/y 18 | sec = 1/x 19 | cot = x/y 20 | 21 | Domain 22 | 23 | The domain is all the values of q that 24 | can be plugged into the function. 25 | 26 | sin, angle can be any angle 27 | cos, angle can be any angle 28 | tan, angle can not be (n + 0.5)*pi n = 0, +-1, +-2, ... 29 | 30 | Range 31 | 32 | The range is all possible values to get 33 | out of the function. 34 | -1 <= sin <=1 csc >=1 and csc <= -1 35 | -1 <= cos <= 1 sec>= 1 and sec <= -1 36 | -ainfinty < tan < ainfinty 37 | 38 | Pythagorean Identities 39 | cos^ + sin^2 = 1 40 | tan^2 + 1 = sec^2 41 | 1 + cot^2 = csc^2 42 | 43 | Tangent and Cotangent Identities 44 | 45 | tan = sin/cos, cot = cos/sin 46 | 47 | Reciprocal Identities 48 | 49 | csc = 1/sin, sin = 1/csc 50 | sec = 1/cos, cos = 1/sec 51 | cot = 1/tan, tan=1/cot 52 | 53 | Half Angle Formulas 54 | 55 | sin(x/2) = +-sgrt(1-cos(x)/2) 56 | cos(x/2) = =-sgrt(1+cos(x)/2) 57 | tan(x/2) = +-sgrt(1-cos(x)/1+cos(x)) 58 | 59 | Sum and Difference Formulas 60 | 61 | sin(a +- b) = sin(a)*cos(b) +- cos(a)*sin(b) 62 | cos(a+-b) = cos(a)*cos(b) +- sin(a)*sin(b) 63 | 64 | Even/Odd Formulas 65 | 66 | sin(-x) = -sin(x) csc(-x) = -csc(x) 67 | cos(-x) = cos(x) sec(-x) = sec(x) 68 | tan(-x) = -tan(x) cot(-x) = -cot(x) 69 | 70 | -------------------------------------------------------------------------------- /nato_phonetic_alphabet/main.py: -------------------------------------------------------------------------------- 1 | import pandas 2 | 3 | data = pandas.read_csv("nato_phonetic_alphabet.csv") 4 | 5 | 6 | def main(): 7 | nato_dict = {row.letter: row.code for (index, row) in data.iterrows()} 8 | end_loop = True 9 | while end_loop: 10 | user_input = input("hii welcome to liron nato phonetic program enter the word you want to phonet:").upper() 11 | try: 12 | nato_words = [nato_dict[letter] for letter in user_input] 13 | print(nato_words) 14 | end_loop = False 15 | except KeyError: 16 | print("Sorry, only letters in the alphabet please") 17 | 18 | 19 | 20 | 21 | if __name__ == "__main__": 22 | main() 23 | -------------------------------------------------------------------------------- /nato_phonetic_alphabet/nato_phonetic_alphabet.csv: -------------------------------------------------------------------------------- 1 | letter,code 2 | A,Alfa 3 | B,Bravo 4 | C,Charlie 5 | D,Delta 6 | E,Echo 7 | F,Foxtrot 8 | G,Golf 9 | H,Hotel 10 | I,India 11 | J,Juliet 12 | K,Kilo 13 | L,Lima 14 | M,Mike 15 | N,November 16 | O,Oscar 17 | P,Papa 18 | Q,Quebec 19 | R,Romeo 20 | S,Sierra 21 | T,Tango 22 | U,Uniform 23 | V,Victor 24 | W,Whiskey 25 | X,X-ray 26 | Y,Yankee 27 | Z,Zulu -------------------------------------------------------------------------------- /password-manager/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "liron": { 3 | "email": "liri25112003@gmail.com", 4 | "password": "fDQpGUY1x,1234" 5 | }, 6 | "alon": { 7 | "email": "liri25112003@gmail.com", 8 | "password": "#nd3[6G;qSfdf" 9 | } 10 | } -------------------------------------------------------------------------------- /password-manager/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/password-manager/logo.png -------------------------------------------------------------------------------- /password-manager/main.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | from tkinter import messagebox 3 | import string 4 | import random 5 | import pyperclip 6 | import json 7 | import os 8 | 9 | # CONSTANTS 10 | NUM_DIGIT_RANDOM_PASSWORD = 10 11 | FONT_NAME = "Courier" 12 | FILE_NAME = "data.json" 13 | 14 | def main(): 15 | global canvas, entry_website_input, entry_email_input, entry_password_input 16 | 17 | # UI SETUP 18 | 19 | window = tkinter.Tk() 20 | window.title("liron Password Manager") 21 | window.config(padx=20, pady=20) 22 | 23 | # Canvas 24 | 25 | canvas = tkinter.Canvas(width=200, height=200, highlightthickness=0) 26 | logo_img = tkinter.PhotoImage(file="logo.png") 27 | canvas.create_image(100, 100, image=logo_img) 28 | canvas.grid(column=1, row=0) 29 | 30 | # Labels 31 | 32 | website_label = tkinter.Label(text="Website:", font=(FONT_NAME, 10)) 33 | website_label.grid(column=0, row=1) 34 | 35 | user_name_label = tkinter.Label(text="Email/Username:", font=(FONT_NAME, 10)) 36 | user_name_label.grid(column=0, row=2) 37 | 38 | password_label = tkinter.Label(text="Password:", font=(FONT_NAME, 10)) 39 | password_label.grid(column=0, row=3) 40 | 41 | # Entry 42 | 43 | entry_website_input = tkinter.Entry(width=32) 44 | entry_website_input.insert(tkinter.END, string="") 45 | entry_website_input.focus() 46 | entry_website_input.grid(column=1, row=1, columnspan=1) 47 | 48 | entry_email_input = tkinter.Entry(width=50) 49 | entry_email_input.insert(tkinter.END, string="") 50 | entry_email_input.insert(index=0, string="liri25112003@gmail.com") 51 | entry_email_input.grid(column=1, row=2, columnspan=2) 52 | 53 | entry_password_input = tkinter.Entry(width=32) 54 | entry_password_input.insert(tkinter.END, string="") 55 | entry_password_input.grid(column=1, row=3) 56 | 57 | # Buttons 58 | 59 | password_button = tkinter.Button(text="Generate Password", highlightthickness=0, command=generate_password, 60 | width=14) 61 | password_button.grid(column=2, row=3) 62 | 63 | add_button = tkinter.Button(text="Add", highlightthickness=0, width=43, command=save_password) 64 | add_button.grid(column=1, row=4, columnspan=2) 65 | 66 | search_button = tkinter.Button(text="Search", highlightthickness=0, command=find_password, width=14) 67 | search_button.grid(column=2, row=1) 68 | 69 | window.mainloop() 70 | 71 | 72 | def find_password() -> None: 73 | """ 74 | Looking if the input in website entry mach one of the existing data in data.jason 75 | Parameters: None 76 | Returns: None 77 | """ 78 | website = entry_website_input.get() 79 | try: 80 | with open(FILE_NAME, 'r') as data_file: 81 | # Reading old data 82 | data = json.load(data_file) 83 | except FileNotFoundError: 84 | tkinter.messagebox.showwarning(title="Data not found", message="No details exists for the website.") 85 | else: 86 | if website in data: 87 | email = data[website]["email"] 88 | password = data[website]["password"] 89 | tkinter.messagebox.showinfo(title="info", 90 | message=f"the name of the website is {website} \n and the email is {email} and the password is {password}") 91 | else: 92 | tkinter.messagebox.showwarning(title="Data not found", message="No details for the website exists.") 93 | 94 | 95 | def generate_password() -> None: 96 | """ 97 | Generate random password to the user 98 | Parameters: None 99 | Returns: None 100 | """ 101 | lower = string.ascii_lowercase 102 | upper = string.ascii_uppercase 103 | num = string.digits 104 | symbols = string.punctuation 105 | all = lower + upper + num + symbols 106 | password = "".join(random.sample(all, NUM_DIGIT_RANDOM_PASSWORD)) 107 | entry_password_input.insert(index=0, string=password) 108 | pyperclip.copy(password) 109 | 110 | 111 | def save_password() -> None: 112 | """ 113 | Add user data to data.txt file 114 | Parameters: None 115 | Returns: None 116 | """ 117 | password = entry_password_input.get() 118 | email = entry_email_input.get() 119 | website = entry_website_input.get() 120 | data = { 121 | website: { 122 | "email": email, 123 | "password": password 124 | } 125 | } 126 | # making sure that that none of the filed empty and that the user sure with the data 127 | if len(website) == 0 or len(password) == 0 or len(email) == 0: 128 | tkinter.messagebox.showerror(title="Oops", message="please make sure you not left any filed empty") 129 | else: 130 | is_ok = tkinter.messagebox.askokcancel(title=website, 131 | message=f"These are the details entered: \nWebsite: {website}\nEmail: {email}\nPassword: {password} is this ok?") 132 | if is_ok: 133 | # write to the file 134 | try: 135 | with open(FILE_NAME, 'r') as data_file: 136 | # Reading old data 137 | data.update(json.load(data_file)) 138 | except FileNotFoundError: 139 | pass 140 | finally: 141 | with open(FILE_NAME, "w") as data_file: 142 | json.dump(data, data_file, indent=4) 143 | # delete the data entered 144 | entry_website_input.delete(first=0, last=tkinter.END) 145 | entry_password_input.delete(first=0, last=tkinter.END) 146 | 147 | 148 | if __name__ == "__main__": 149 | main() 150 | -------------------------------------------------------------------------------- /pomodoro_project/main.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | import math 3 | 4 | # CONSTANTS 5 | 6 | PINK = "#e2979c" 7 | RED = "#e7305b" 8 | GREEN = "#9bdeac" 9 | YELLOW = "#f7f5dd" 10 | FONT_NAME = "Courier" 11 | WORK_MIN = 25 12 | SHORT_BREAK_MIN = 5 13 | LONG_BREAK_MIN = 20 14 | 15 | # Global Variables 16 | 17 | reps = 0 18 | timer = None 19 | 20 | 21 | def main(): 22 | global window, canvas, title_label, check_marks, timer_text 23 | 24 | # UI SETUP 25 | 26 | window = tkinter.Tk() 27 | window.title("Pomodoro") 28 | window.config(padx=100, pady=50, bg=YELLOW) 29 | 30 | # Labels 31 | 32 | title_label = tkinter.Label(text="Timer", fg=GREEN, bg=YELLOW, font=(FONT_NAME, 50)) 33 | title_label.grid(column=1, row=0) 34 | 35 | check_marks = tkinter.Label(fg=GREEN, bg=YELLOW) 36 | check_marks.grid(column=1, row=3) 37 | 38 | # Canvas 39 | 40 | canvas = tkinter.Canvas(width=200, height=224, bg=YELLOW, highlightthickness=0) 41 | tomato_img = tkinter.PhotoImage(file="tomato.png") 42 | canvas.create_image(100, 112, image=tomato_img) 43 | timer_text = canvas.create_text(100, 130, text="00:00", fill="white", font=(FONT_NAME, 35, "bold")) 44 | canvas.grid(column=1, row=1) 45 | 46 | # Buttons 47 | 48 | start_button = tkinter.Button(text="Start", highlightthickness=0, command=start_timer) 49 | start_button.grid(column=0, row=2) 50 | 51 | reset_button = tkinter.Button(text="Reset", highlightthickness=0, command=reset_timer) 52 | reset_button.grid(column=2, row=2) 53 | 54 | window.mainloop() 55 | 56 | 57 | # TIMER RESET 58 | 59 | def reset_timer() -> None: 60 | """ 61 | Reset the time the text reps and check marks 62 | Parameters: None 63 | Returns: None 64 | """ 65 | window.after_cancel(timer) 66 | canvas.itemconfig(timer_text, text="00:00") 67 | title_label.config(text="Timer") 68 | check_marks.config(text="") 69 | global reps 70 | reps = 0 71 | 72 | 73 | # TIMER MECHANISM 74 | 75 | def start_timer() -> None: 76 | """ 77 | Start the timer and identifying which session it is 78 | Parameters: None 79 | Returns: None 80 | """ 81 | global reps 82 | reps += 1 83 | 84 | work_sec = WORK_MIN * 60 85 | short_break_sec = SHORT_BREAK_MIN * 60 86 | long_break_sec = LONG_BREAK_MIN * 60 87 | 88 | if reps % 8 == 0: 89 | count_down(long_break_sec) 90 | title_label.config(text="Break", fg=RED) 91 | elif reps % 2 == 0: 92 | count_down(short_break_sec) 93 | title_label.config(text="Break", fg=PINK) 94 | else: 95 | count_down(work_sec) 96 | title_label.config(text="Work", fg=GREEN) 97 | 98 | 99 | # COUNTDOWN MECHANISM 100 | 101 | def count_down(count: int) -> None: 102 | """ 103 | Counts down the time and show to screen 104 | Parameters: count - the time of the current session in sec 105 | Returns: None 106 | """ 107 | # calculate, the num of min and sec of the session 108 | count_min = math.floor(count / 60) 109 | count_sec = count % 60 110 | if count_sec < 10: 111 | count_sec = f"0{count_sec}" 112 | canvas.itemconfig(timer_text, text=f"{count_min}:{count_sec}") 113 | # check when the time of the session is done 114 | if count > 0: 115 | global timer 116 | timer = window.after(1000, count_down, count - 1) 117 | else: # adding check marks 118 | start_timer() 119 | marks = "" 120 | work_sessions = math.floor(reps / 2) 121 | for _ in range(work_sessions): 122 | marks += "✔" 123 | check_marks.config(text=marks) 124 | 125 | 126 | if __name__ == "__main__": 127 | main() 128 | -------------------------------------------------------------------------------- /pomodoro_project/tomato.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/pomodoro_project/tomato.png -------------------------------------------------------------------------------- /pong_game/__pycache__/ball.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/pong_game/__pycache__/ball.cpython-310.pyc -------------------------------------------------------------------------------- /pong_game/__pycache__/paddle.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/pong_game/__pycache__/paddle.cpython-310.pyc -------------------------------------------------------------------------------- /pong_game/__pycache__/pong_score_board.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/pong_game/__pycache__/pong_score_board.cpython-310.pyc -------------------------------------------------------------------------------- /pong_game/ball.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | 3 | # constant in ball class 4 | BALL_START_SPOT = (0, 0) 5 | BALL_SPEED = 0.1 6 | 7 | 8 | class Ball(Turtle): 9 | def __init__(self) -> object: 10 | super().__init__() 11 | """ 12 | Constructor of the class make ball object and control the behavior of the ball. 13 | Parameters: shape:str - set the paddle shape, penup: - hide the ball paint, 14 | goto(BALL_START_SPOT): tuple - set the ball position, color: str - set the ball color, 15 | shapesize(stretch_wid=1, stretch_len=1): tuple - set the ball size, 16 | x_move: int - move ball in x cordinate, y_move: int - move ball in y cordinate 17 | Returns: ball object 18 | """ 19 | self.shape("circle") 20 | self.shapesize(stretch_wid=1, stretch_len=1) 21 | self.color("white") 22 | self.penup() 23 | self.goto(BALL_START_SPOT) 24 | self.x_move = 10 25 | self.y_move = 10 26 | self.move_speed = BALL_SPEED 27 | 28 | def move(self) -> None: 29 | """ 30 | move the ball in the game 31 | Parameters: None 32 | Returns: None 33 | """ 34 | self.penup() 35 | new_x = self.xcor() + self.x_move 36 | new_y = self.ycor() + self.y_move 37 | self.goto(new_x, new_y) 38 | self.screen.update() 39 | 40 | def bounce(self, direction_bounce: str) -> None: 41 | """ 42 | bounce the ball in the game 43 | Parameters: None 44 | Returns: None 45 | """ 46 | if direction_bounce == "y": 47 | self.y_move *= -1 48 | else: 49 | self.x_move *= -1 50 | self.move_speed *= 0.95 51 | -------------------------------------------------------------------------------- /pong_game/liron_pong_game.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import random 3 | from paddle import Paddle 4 | from ball import Ball 5 | from pong_score_board import ScoreBoardPong 6 | import time 7 | import math 8 | 9 | # constant in game 10 | UP = 90 11 | DOWN = 270 12 | SCREEN_WIDTH = 800 13 | SCREEN_HEIGHT = 600 14 | SCREEN_COLOR = "black" 15 | PADDLE_MOVE_FORWARD_STEP = 100 16 | RIGHT_PADDLR_FIRST_SPOT = (350, 0) 17 | LEFT_PADDLR_FIRST_SPOT = (-350, 0) 18 | BALL_START_SPOT = (0, 0) 19 | BALL_SIZE = 20 20 | MAX_DISTANCE_BALL_AND_PADDLE = 50 21 | BALL_MAX_X_COORDINATE_WITE_PADDLE = 325 22 | BALL_MAX_X_COORDINATE = 380 23 | MAX_USER_SCORE = 10 24 | 25 | paddle = turtle.Turtle("square") 26 | screen = turtle.Screen() 27 | 28 | # making the paddles and ball objects 29 | right_paddle = Paddle(RIGHT_PADDLR_FIRST_SPOT) 30 | left_paddle = Paddle(LEFT_PADDLR_FIRST_SPOT) 31 | game_ball = Ball() 32 | score_board_pong = ScoreBoardPong() 33 | 34 | 35 | def main(): 36 | turtle.title("liron pong game") 37 | screen.setup(width=SCREEN_WIDTH, height=SCREEN_HEIGHT) 38 | screen.bgcolor(SCREEN_COLOR) 39 | screen.tracer(0) 40 | 41 | # take user input 42 | screen.listen() 43 | screen.onkey(fun=lambda: right_paddle.move_paddle(UP), key="Up") 44 | screen.onkey(fun=lambda: right_paddle.move_paddle(DOWN), key="Down") 45 | screen.onkey(fun=lambda: left_paddle.move_paddle(UP), key="w") 46 | screen.onkey(fun=lambda: left_paddle.move_paddle(DOWN), key="s") 47 | 48 | # game loop 49 | game_loop() 50 | 51 | screen.exitonclick() 52 | 53 | 54 | def game_loop() -> None: 55 | # game loop 56 | is_game_on = 0 57 | while is_game_on < MAX_USER_SCORE: 58 | time.sleep(game_ball.move_speed) 59 | screen.update() 60 | game_ball.move() 61 | 62 | # detect collision with up and down walls 63 | if game_ball.ycor() > SCREEN_HEIGHT / 2 - BALL_SIZE or game_ball.ycor() < -(SCREEN_HEIGHT / 2 - BALL_SIZE): 64 | game_ball.bounce("y") 65 | 66 | # detect collision with paddle 67 | if game_ball.distance(right_paddle) < MAX_DISTANCE_BALL_AND_PADDLE and game_ball.xcor() > BALL_MAX_X_COORDINATE_WITE_PADDLE or game_ball.distance(left_paddle) < MAX_DISTANCE_BALL_AND_PADDLE and game_ball.xcor() < -BALL_MAX_X_COORDINATE_WITE_PADDLE: 68 | game_ball.bounce("x") 69 | 70 | # detect collision with right and left walls and update score 71 | if game_ball.xcor() > BALL_MAX_X_COORDINATE: 72 | game_ball.goto(BALL_START_SPOT) 73 | game_ball.bounce("x") 74 | score_board_pong.right_score += 1 75 | score_board_pong.update_score(score_board_pong.left_score, score_board_pong.right_score) 76 | elif game_ball.xcor() < -BALL_MAX_X_COORDINATE: 77 | game_ball.goto(BALL_START_SPOT) 78 | game_ball.bounce("x") 79 | score_board_pong.left_score += 1 80 | score_board_pong.update_score(score_board_pong.left_score, score_board_pong.right_score) 81 | 82 | is_game_on = max(score_board_pong.right_score, score_board_pong.left_score) 83 | 84 | 85 | if __name__ == "__main__": 86 | main() 87 | -------------------------------------------------------------------------------- /pong_game/paddle.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | 3 | # constant in paddle class 4 | PADDLE_MOVE_FORWARD_STEP = 70 5 | PADDLE_MAX_Y = 240 6 | 7 | 8 | class Paddle(Turtle): 9 | def __init__(self, position: tuple) -> object: 10 | super().__init__() 11 | """ 12 | Constructor of the class make paddle object and control the behavior of the paddle. 13 | Parameters: shape:str - set the paddle shape, penup: - hide the paddle paint, 14 | goto(position): tuple - set the paddle position, color: str - set the paddle color, 15 | shapesize(stretch_wid=5, stretch_len=1): tuple - set the paddle size 16 | Returns: paddle object 17 | """ 18 | 19 | self.shape("square") 20 | self.position = position 21 | self.shapesize(stretch_wid=5, stretch_len=1) 22 | self.color("white") 23 | self.penup() 24 | self.goto(position) 25 | 26 | def move_paddle(self, moving_direction: int) -> None: 27 | """ 28 | move the paddle up or down 29 | Parameters: moving_direction: int var that hold the wanted direction 30 | Returns: None 31 | """ 32 | #if self.ycor() > PADDLE_MAX_Y: 33 | # self.ycor(PADDLE_MAX_Y - 50) 34 | #elif self.ycor() < -PADDLE_MAX_Y: 35 | # self.ycor(PADDLE_MAX_Y + 50) 36 | #else: 37 | paddle_starting_direction = self.heading() 38 | self.setheading(moving_direction) 39 | self.fd(PADDLE_MOVE_FORWARD_STEP) 40 | self.setheading(paddle_starting_direction) 41 | self.screen.update() 42 | -------------------------------------------------------------------------------- /pong_game/pong_score_board.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | 3 | # constant in score board class 4 | FONT = ("Verdana", 60, "normal") 5 | ALIGN = 'center' 6 | MIDDLE_UP_SCREEN_x_POSITION = 0 7 | MIDDLE_UP_SCREEN_Y_POSITION = 220 8 | 9 | 10 | class ScoreBoardPong(Turtle): 11 | def __init__(self) -> object: 12 | super().__init__() 13 | """ 14 | Constructor of the class make ScoreBoard object and control the text behavior in the code. 15 | Parameters: score : tuple the score of the users - pencolor: str the color of the board 16 | penup: penup: hide the pen of score board for first show on screen 17 | hideturtle: - hide the score board for first show on screen - goto: set the score board place on screen 18 | write: set the score board text 19 | Returns: score board object 20 | """ 21 | 22 | self.pencolor("white") 23 | self.penup() 24 | self.hideturtle() 25 | self.goto(MIDDLE_UP_SCREEN_x_POSITION, MIDDLE_UP_SCREEN_Y_POSITION) 26 | self.right_score = 0 27 | self.left_score = 0 28 | self.update_score(self.left_score, self.right_score) 29 | 30 | def update_score(self, new_score_right_update: int, new_score_left_update: int) -> None: 31 | """ 32 | update the score of the users and show to screen 33 | Parameters: -> str 34 | Returns: None 35 | """ 36 | self.clear() 37 | self.write(F" {new_score_left_update} {new_score_right_update}", font=FONT, align=ALIGN) 38 | 39 | -------------------------------------------------------------------------------- /quiz-app/data.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | parameters = { 4 | "amount": 10, 5 | "type": "boolean" 6 | } 7 | 8 | response = requests.get(url="https://opentdb.com/api.php" , params= parameters) 9 | response.raise_for_status() 10 | data = response.json() 11 | 12 | 13 | question_data = data["results"] 14 | 15 | -------------------------------------------------------------------------------- /quiz-app/images/false.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/quiz-app/images/false.png -------------------------------------------------------------------------------- /quiz-app/images/true.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/quiz-app/images/true.png -------------------------------------------------------------------------------- /quiz-app/main.py: -------------------------------------------------------------------------------- 1 | from question_model import Question 2 | from data import question_data 3 | from quiz_brain import QuizBrain 4 | from ui import QuizInterface 5 | 6 | question_bank = [] 7 | for question in question_data: 8 | question_text = question["question"] 9 | question_answer = question["correct_answer"] 10 | new_question = Question(question_text, question_answer) 11 | question_bank.append(new_question) 12 | 13 | 14 | quiz = QuizBrain(question_bank) 15 | quiz_ui = QuizInterface(quiz) 16 | 17 | #while quiz.still_has_questions(): 18 | # quiz.next_question() 19 | 20 | print("You've completed the quiz") 21 | print(f"Your final score was: {quiz.score}/{quiz.question_number}") 22 | -------------------------------------------------------------------------------- /quiz-app/question_model.py: -------------------------------------------------------------------------------- 1 | class Question: 2 | 3 | def __init__(self, q_text, q_answer): 4 | self.text = q_text 5 | self.answer = q_answer 6 | -------------------------------------------------------------------------------- /quiz-app/quiz_brain.py: -------------------------------------------------------------------------------- 1 | import html 2 | 3 | 4 | class QuizBrain: 5 | 6 | def __init__(self, q_list): 7 | self.question_number = 0 8 | self.score = 0 9 | self.question_list = q_list 10 | self.current_question = None 11 | 12 | def still_has_questions(self): 13 | return self.question_number < len(self.question_list) 14 | 15 | def next_question(self) -> str: 16 | self.current_question = self.question_list[self.question_number] 17 | self.question_number += 1 18 | q_text = html.unescape(self.current_question.text) 19 | return f"Q.{self.question_number}: {q_text}" 20 | # user_answer = input(f"Q.{self.question_number}: {q_text} (True/False): ") 21 | # self.check_answer(user_answer) 22 | 23 | def check_answer(self, user_answer: str) -> bool: 24 | correct_answer = self.current_question.answer 25 | if user_answer.lower() == correct_answer.lower(): 26 | self.score += 1 27 | return True 28 | else: 29 | return False 30 | 31 | -------------------------------------------------------------------------------- /quiz-app/ui.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | from quiz_brain import QuizBrain 3 | 4 | THEME_COLOR = "#375362" 5 | 6 | 7 | class QuizInterface: 8 | 9 | def __init__(self, quiz_brain: QuizBrain): 10 | self.quiz = quiz_brain 11 | self.window = tkinter.Tk() 12 | self.window.title("liron quiz app") 13 | self.window.config(padx=20, pady=20, bg=THEME_COLOR) 14 | 15 | # Canvas 16 | 17 | self.canvas = tkinter.Canvas(width=300, height=250, highlightthickness=0, bg="white") 18 | self.question_text = self.canvas.create_text(140, 125, text="question", fill="black", 19 | font=("arial", 20, "italic"), width=280) 20 | self.canvas.grid(column=0, row=1, columnspan=2, pady=50) 21 | 22 | # Labels 23 | 24 | self.score_label = tkinter.Label(text="Score: 0", font=("ariel", 10, "bold"), bg=THEME_COLOR, fg="white") 25 | self.score_label.grid(column=1, row=0, ipady=20) 26 | 27 | false_image = tkinter.PhotoImage(file="images/false.png") 28 | self.false_button = tkinter.Button(image=false_image, highlightthickness=0, bg="red", 29 | command=self.false_pressed) 30 | self.false_button.grid(column=1, row=2, pady=10) 31 | 32 | true_image = tkinter.PhotoImage(file="images/true.png") 33 | self.true_button = tkinter.Button(image=true_image, highlightthickness=0, bg="green", 34 | command=self.true_pressed) 35 | self.true_button.grid(column=0, row=2, pady=10) 36 | 37 | self.get_next_question() 38 | 39 | self.window.mainloop() 40 | 41 | def get_next_question(self) -> None: 42 | if self.quiz.still_has_questions(): 43 | q_text = self.quiz.next_question() 44 | self.canvas.itemconfig(self.question_text, text=q_text) 45 | else: 46 | self.canvas.itemconfig(self.question_text, text="End of the quiz!") 47 | self.true_button.config(state="disabled") 48 | self.false_button.config(state="disabled") 49 | def true_pressed(self) -> None: 50 | is_right = self.quiz.check_answer("True") 51 | self.give_feedback(is_right) 52 | 53 | def false_pressed(self) -> None: 54 | is_right = self.quiz.check_answer("False") 55 | self.give_feedback(is_right) 56 | 57 | def give_feedback(self, is_right: bool) -> None: 58 | if is_right: 59 | self.canvas.configure(bg="green") 60 | self.window.after(1000, lambda: self.canvas.configure(bg="white")) 61 | self.score_label.configure(text=f"score: {self.quiz.score}") 62 | else: 63 | self.canvas.configure(bg="red") 64 | self.window.after(1000, lambda: self.canvas.configure(bg="white")) 65 | 66 | 67 | self.window.after(1000, self.get_next_question) 68 | -------------------------------------------------------------------------------- /runner_game/Fly1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/runner_game/Fly1.png -------------------------------------------------------------------------------- /runner_game/Fly2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/runner_game/Fly2.png -------------------------------------------------------------------------------- /runner_game/Pixeltype.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/runner_game/Pixeltype.ttf -------------------------------------------------------------------------------- /runner_game/audio_jump.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/runner_game/audio_jump.mp3 -------------------------------------------------------------------------------- /runner_game/game.py: -------------------------------------------------------------------------------- 1 | import pygame 2 | from sys import exit 3 | from random import randint, choice 4 | 5 | class Player(pygame.sprite.Sprite): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | player_walk_1 = pygame.image.load("player_walk_1.png").convert_alpha() 10 | player_walk_2 = pygame.image.load("player_walk_2.png").convert_alpha() 11 | self.player_walk = [player_walk_1, player_walk_2] 12 | self.player_index = 0 13 | self.player_jump = pygame.image.load("jump.png").convert_alpha() 14 | 15 | self.image = self.player_walk[self.player_index] 16 | self.rect = self.image.get_rect(midbottom=(80, 300)) 17 | self.gravity = 0 18 | 19 | self.jump_sound = pygame.mixer.Sound('audio_jump.mp3') 20 | self.jump_sound.set_volume(0.2) 21 | def player_input(self): 22 | keys = pygame.key.get_pressed() 23 | if keys[pygame.K_SPACE] and self.rect.bottom >= 300: 24 | self.gravity = -20 25 | self.jump_sound.play() 26 | 27 | def apply_gravity(self): 28 | self.gravity += 1 29 | self.rect.y += self.gravity 30 | if self.rect.bottom >= 300: 31 | self.rect.bottom = 300 32 | def animation_state(self): 33 | if self.rect.bottom < 300: 34 | self.image = self.player_jump 35 | else: 36 | self.player_index += 0.1 37 | if self.player_index >= len(self.player_walk): 38 | self.player_index = 0 39 | self.image = self.player_walk[int(self.player_index)] 40 | 41 | def update(self) -> None: 42 | self.player_input() 43 | self.apply_gravity() 44 | self.animation_state() 45 | 46 | class Obstacle(pygame.sprite.Sprite): 47 | def __init__(self,type): 48 | super().__init__() 49 | if type == 'Fly': 50 | fly_1 = pygame.image.load("Fly1.png").convert_alpha() 51 | fly_2 = pygame.image.load("Fly2.png").convert_alpha() 52 | self.frames = [fly_1, fly_2] 53 | y_pos = 210 54 | else: 55 | snail_1 = pygame.image.load("snail1.png").convert_alpha() 56 | snail_2 = pygame.image.load("snail2.png").convert_alpha() 57 | self.frames = [snail_1, snail_2] 58 | y_pos = 300 59 | self.animation_index = 0 60 | self.image = self.frames[self.animation_index] 61 | self.rect = self.image.get_rect(midbottom=(randint(900, 1100), y_pos)) 62 | 63 | def animation_state(self): 64 | self.animation_index += 0.1 65 | if self.animation_index >= len(self.frames): 66 | self.animation_index = 0 67 | self.image = self.frames[int(self.animation_index)] 68 | 69 | def update(self): 70 | self.animation_state() 71 | self.rect.x -= 6 72 | self.destroy() 73 | def destroy(self): 74 | if self.rect.x <= -100: 75 | self.kill() 76 | 77 | def display_score(): 78 | current_time = pygame.time.get_ticks() - start_time 79 | score_surf = test_font.render(f' score: {int(current_time / 1000)}', False, (64, 64, 64)) 80 | score_rect = score_surf.get_rect(center=(400, 50)) 81 | screen.blit(score_surf, score_rect) 82 | return current_time 83 | 84 | def collision_sprite(): 85 | if pygame.sprite.spritecollide(player.sprite, obstacle_group, False): 86 | obstacle_group.empty() 87 | return False 88 | else: 89 | return True 90 | 91 | SCREEN_SIZE = (800, 400) 92 | pygame.init() 93 | screen = pygame.display.set_mode(SCREEN_SIZE) 94 | clock = pygame.time.Clock() 95 | 96 | test_font = pygame.font.Font("Pixeltype.ttf", 50) 97 | game_active = True 98 | start_time = 0 99 | score = 0 100 | bg_music = pygame.mixer.Sound('music.wav') 101 | bg_music.play() 102 | 103 | obstacle_group = pygame.sprite.Group() 104 | player = pygame.sprite.GroupSingle() 105 | player.add(Player()) 106 | 107 | sky_surface = pygame.image.load("../python stuff/Sky.png").convert() 108 | ground_surface = pygame.image.load("ground.png").convert() 109 | 110 | player_stand = pygame.image.load("player_stand.png").convert_alpha() 111 | player_stand = pygame.transform.rotozoom(player_stand, 0, 2) 112 | player_stand_rect = player_stand.get_rect(center=(400, 200)) 113 | 114 | game_name = test_font.render('Pixel Runner', False, (111, 96, 169)) 115 | game_name_rect = game_name.get_rect(center=(400, 80)) 116 | 117 | game_message = test_font.render('Press space to run', False, (111, 196, 169)) 118 | game_message_rect = game_message.get_rect(center=(400, 320)) 119 | 120 | # Timer 121 | obstacle_timer = pygame.USEREVENT + 1 122 | pygame.time.set_timer(obstacle_timer, 1500) 123 | 124 | snail_animation_timer = pygame.USEREVENT + 2 125 | pygame.time.set_timer(snail_animation_timer, 500) 126 | 127 | fly_animation_timer = pygame.USEREVENT + 3 128 | pygame.time.set_timer(fly_animation_timer, 200) 129 | 130 | while True: 131 | for event in pygame.event.get(): 132 | if event.type == pygame.QUIT: 133 | pygame.quit() 134 | exit() 135 | if game_active: 136 | if event.type == pygame.MOUSEMOTION: 137 | if event.type == pygame.KEYDOWN: 138 | print("hii") 139 | else: 140 | if event.type == pygame.KEYDOWN and pygame.K_SPACE: 141 | game_active = True 142 | start_time = pygame.time.get_ticks() 143 | if game_active: 144 | if event.type == obstacle_timer and game_active: 145 | obstacle_group.add(Obstacle(choice(['fly', 'snail', 'snail', 'snail']))) 146 | if event.type == snail_animation_timer: 147 | print("hii") 148 | if event.type == fly_animation_timer: 149 | print("hii2") 150 | 151 | if game_active: 152 | screen.blit(sky_surface, (0, 0)) 153 | screen.blit(ground_surface, (0, 300)) 154 | score = display_score() 155 | # Player 156 | player.draw(screen) 157 | obstacle_group.draw(screen) 158 | obstacle_group.update() 159 | player.update() 160 | 161 | # collision 162 | game_active = collision_sprite() 163 | else: 164 | screen.fill((94, 129, 162)) 165 | screen.blit(player_stand, player_stand_rect) 166 | screen.blit(game_message, game_message_rect) 167 | screen.blit(game_name, game_name_rect) 168 | player_gravity = 0 169 | score_message = test_font.render(f'Your score: {int(score / 1000)} ', False, (111, 196, 169)) 170 | score_message_rect = score_message.get_rect(center=(400, 360)) 171 | if score == 0: 172 | screen.blit(game_message, game_message_rect) 173 | else: 174 | screen.blit(score_message, score_message_rect) 175 | 176 | 177 | pygame.display.update() 178 | clock.tick(60) 179 | -------------------------------------------------------------------------------- /runner_game/ground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/runner_game/ground.png -------------------------------------------------------------------------------- /runner_game/jump.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/runner_game/jump.png -------------------------------------------------------------------------------- /runner_game/music.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/runner_game/music.wav -------------------------------------------------------------------------------- /runner_game/player_stand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/runner_game/player_stand.png -------------------------------------------------------------------------------- /runner_game/player_walk_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/runner_game/player_walk_1.png -------------------------------------------------------------------------------- /runner_game/player_walk_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/runner_game/player_walk_2.png -------------------------------------------------------------------------------- /runner_game/snail1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/runner_game/snail1.png -------------------------------------------------------------------------------- /runner_game/snail2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/runner_game/snail2.png -------------------------------------------------------------------------------- /snake_game/__pycache__/food.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/snake_game/__pycache__/food.cpython-310.pyc -------------------------------------------------------------------------------- /snake_game/__pycache__/score_board.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/snake_game/__pycache__/score_board.cpython-310.pyc -------------------------------------------------------------------------------- /snake_game/__pycache__/snake.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/snake_game/__pycache__/snake.cpython-310.pyc -------------------------------------------------------------------------------- /snake_game/data.txt: -------------------------------------------------------------------------------- 1 | 24 -------------------------------------------------------------------------------- /snake_game/food.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | import random 3 | 4 | # constant in food class 5 | SCREEN_WIDTH = 600 6 | SCREEN_HEIGHT = 600 7 | SIZE_FOOD = 20 8 | MAX_RANDOM_FOOD_SPOT = SCREEN_WIDTH / 2 - SIZE_FOOD 9 | 10 | 11 | class Food(Turtle): 12 | 13 | def __init__(self) -> object: 14 | super().__init__() 15 | """ 16 | Constructor of the class make food object and inheritance from turtle class. 17 | Parameters 18 | shape : str - set the food shap 19 | penup : None - set the pen of the food up 20 | shapesize: tuple - set the size of food 21 | color: str - set the color of the food 22 | speed: str - set the speed of the food 23 | goto: tuple -set the spot of the food on screen 24 | Returns: food object 25 | """ 26 | self.shape("circle") 27 | self.penup() 28 | self.shapesize(stretch_len=0.5, stretch_wid=0.5) 29 | self.color("red") 30 | self.speed("fastest") 31 | self.change_food_spot() 32 | 33 | def change_food_spot(self) -> None: 34 | """ 35 | changes the food spot on screen 36 | Parameters: None 37 | Returns: None 38 | """ 39 | random_x = random.randint(-MAX_RANDOM_FOOD_SPOT, MAX_RANDOM_FOOD_SPOT) 40 | random_y = random.randint(-MAX_RANDOM_FOOD_SPOT, MAX_RANDOM_FOOD_SPOT) 41 | self.goto(random_x, random_y) 42 | -------------------------------------------------------------------------------- /snake_game/liron_snake_game.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import random 3 | import time 4 | from snake import Snake 5 | from food import Food 6 | from score_board import ScoreBoard 7 | 8 | # constant in game 9 | UP = 90 10 | DOWN = 270 11 | RIGHT = 0 12 | LEFT = 180 13 | SCREEN_WIDTH = 600 14 | SCREEN_HEIGHT = 600 15 | ADJUST_MAX_SNAKE_SPOT = 0.2 16 | MAX_SNAKE_SPOT = SCREEN_WIDTH / 2 - ADJUST_MAX_SNAKE_SPOT 17 | FONT = ("Verdana", 15, "normal") 18 | ALIGN = 'center' 19 | 20 | # making instances of snake food and score_board class 21 | snake = Snake() 22 | food = Food() 23 | score_board = ScoreBoard() 24 | 25 | 26 | def main(): 27 | turtle.title("liron snake game") 28 | screen = turtle.Screen() 29 | screen.setup(width=600, height=600) 30 | screen.bgcolor("black") 31 | screen.tracer(0) 32 | # updating the screen 33 | screen.update() 34 | 35 | # listening to user inputs 36 | screen.listen() 37 | screen.onkey(fun=lambda: snake.change_snake_direction(UP), key="Up") 38 | screen.onkey(fun=lambda: snake.change_snake_direction(DOWN), key="Down") 39 | screen.onkey(fun=lambda: snake.change_snake_direction(RIGHT), key="Right") 40 | screen.onkey(fun=lambda: snake.change_snake_direction(LEFT), key="Left") 41 | 42 | is_game_on = True 43 | while is_game_on: 44 | # update the screen after snake body done moving forward 45 | screen.update() 46 | time.sleep(0.1) 47 | snake.move_forward_snake_body() 48 | 49 | # detect collision with food and update score board and extand snake 50 | if snake.snake_seg_list[0].distance(food) < 15: 51 | food.change_food_spot() 52 | score_board.increase_score() 53 | score_board.update_score_board() 54 | snake.extend_snake() 55 | 56 | # detect collision with walls 57 | if snake.snake_seg_list[0].xcor() > MAX_SNAKE_SPOT or snake.snake_seg_list[0].xcor() < -MAX_SNAKE_SPOT or \ 58 | snake.snake_seg_list[0].ycor() < -MAX_SNAKE_SPOT or snake.snake_seg_list[0].ycor() > MAX_SNAKE_SPOT: 59 | score_board.reset() 60 | snake.reset() 61 | # detect collision with tall 62 | for snake_segment in snake.snake_seg_list[1:]: 63 | if snake.snake_seg_list[0].distance(snake_segment) < 10: 64 | score_board.reset() 65 | snake.reset() 66 | screen.exitonclick() 67 | 68 | 69 | if __name__ == "__main__": 70 | main() 71 | -------------------------------------------------------------------------------- /snake_game/score_board.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | import os 3 | 4 | # constant in score board class 5 | FONT = ("Verdana", 15, "normal") 6 | ALIGN = 'center' 7 | FIRST_SCORE = 0 8 | MIDDLE_UP_SCREEN_x_POSITION = 0 9 | MIDDLE_UP_SCREEN_Y_POSITION = 270 10 | 11 | 12 | class ScoreBoard(Turtle): 13 | def __init__(self) -> object: 14 | super().__init__() 15 | """ 16 | Constructor of the class make ScoreBoard object and control the text behavior in the code. 17 | Parameters: score : int - the score of the user 18 | pencolor: str - the color of the board 19 | penup: penup: - hide the pen of score board for first show on screen 20 | hideturtle: - hide the score board for first show on screen 21 | goto: - set the score board place on screen 22 | write: - set the score board text 23 | Returns: score board object 24 | """ 25 | self.score = FIRST_SCORE 26 | with open("data.txt") as data_file: 27 | self.high_score = int(data_file.read()) 28 | self.pencolor("white") 29 | self.penup() 30 | self.hideturtle() 31 | self.goto(MIDDLE_UP_SCREEN_x_POSITION, MIDDLE_UP_SCREEN_Y_POSITION) 32 | self.update_score_board() 33 | 34 | def update_score_board(self) -> None: 35 | """ 36 | updating the score board 37 | Parameters: None 38 | Returns: None 39 | """ 40 | self.clear() 41 | self.write(F"Score: {self.score} High score {self.high_score}", font=FONT, align=ALIGN) 42 | 43 | def increase_score(self) -> None: 44 | """ 45 | increase the score of the user 46 | Parameters: None 47 | Returns:None 48 | """ 49 | self.score += 1 50 | 51 | def reset(self) -> None: 52 | """ 53 | reset the score of the user 54 | Parameters: None 55 | Returns: None 56 | """ 57 | if self.score > self.high_score: 58 | self.high_score = self.score 59 | with open("data.txt", mode="w") as data_file: 60 | data_file.write(f"{self.high_score}") 61 | self.score = 0 62 | self.update_score_board() 63 | -------------------------------------------------------------------------------- /snake_game/snake.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | # constant in snake class 4 | STARTING_POSITIONS = [(0, 0), (-20, 0), (-40, 0)] 5 | SNAKE_MOVE_FORWARD_STEP = 20 6 | 7 | 8 | class Snake(): 9 | ### class that control the snake body### 10 | 11 | def __init__(self) -> object: 12 | """ 13 | Constructor of the class make snake object. 14 | Parameters: snake_seg_list : list - list of snake segment 15 | Returns: snake object 16 | """ 17 | self.snake_seg_list = [] 18 | self.create_segment() 19 | self.snake_head = self.snake_seg_list[0] 20 | 21 | def create_segment(self) -> None: 22 | for position in STARTING_POSITIONS: 23 | self.add_segment(position) 24 | 25 | def add_segment(self, position) -> None: 26 | """ 27 | extend the snake body 28 | Parameters: position: tuple 29 | Returns: None 30 | """ 31 | new_seg = turtle.Turtle("square") 32 | new_seg.color("white") 33 | new_seg.penup() 34 | new_seg.goto(position) 35 | self.snake_seg_list.append(new_seg) 36 | 37 | def extend_snake(self) -> None: 38 | """ 39 | extend the snake body 40 | Parameters: None 41 | Returns: None 42 | """ 43 | self.add_segment(self.snake_seg_list[-1].position()) 44 | 45 | def move_forward_snake_body(self) -> None: 46 | """ 47 | move the snake body forward 48 | Parameters: None 49 | Returns: None 50 | """ 51 | for snake_seg_num in range(len(self.snake_seg_list) - 1, 0, -1): 52 | new_x = self.snake_seg_list[snake_seg_num - 1].xcor() 53 | new_y = self.snake_seg_list[snake_seg_num - 1].ycor() 54 | self.snake_seg_list[snake_seg_num].goto(new_x, new_y) 55 | self.snake_seg_list[0].fd(SNAKE_MOVE_FORWARD_STEP) 56 | 57 | def change_snake_direction(self, heading_change: int) -> None: 58 | """ 59 | change the snake direction 60 | Parameters: heading_change: int - set the number of change in direction 61 | Returns: None 62 | """ 63 | # checking that the user input and current hading not opposite from each other 64 | snake_heading_check = (self.snake_seg_list[0].heading() + 180) % 360 65 | if snake_heading_check != heading_change: 66 | self.snake_seg_list[0].setheading(heading_change) 67 | 68 | def reset(self) -> None: 69 | """ 70 | reset the screen 71 | Parameters: None 72 | Returns: None 73 | """ 74 | for seg in self.snake_seg_list: 75 | seg.goto(1000,1000) 76 | self.snake_seg_list.clear() 77 | self.create_segment() 78 | self.snake_head = self.snake_seg_list[0] 79 | -------------------------------------------------------------------------------- /sudoku solver.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | grid = [[0, 0, 6, 0, 0, 0, 7, 5, 1], 4 | [2, 0, 0, 7, 0, 0, 0, 9, 0], 5 | [0, 5, 0, 0, 0, 6, 4, 8, 0], 6 | [9, 0, 2, 0, 7, 0, 0, 0, 4], 7 | [3, 7, 4, 0, 0, 0, 8, 0, 0], 8 | [1, 8, 5, 4, 2, 9, 0, 0, 7], 9 | [0, 0, 1, 9, 0, 0, 0, 7, 0], 10 | [0, 0, 9, 0, 5, 0, 1, 0, 0], 11 | [0, 2, 7, 6, 0, 3, 0, 4, 5]] 12 | 13 | print(np.matrix(grid), end="now solved \n") 14 | 15 | 16 | def possible(y: int, x: int, n: int): 17 | global grid 18 | for i in range(0, 9): 19 | if grid[y][i] == n: 20 | return False 21 | 22 | for i in range(0, 9): 23 | if grid[i][x] == n: 24 | return False 25 | 26 | x0 = (x // 3) * 3 27 | y0 = (y // 3) * 3 28 | for i in range(0, 3): 29 | for j in range(0, 3): 30 | if grid[y0 + i][x0 + j] == n: 31 | return False 32 | return True 33 | 34 | 35 | def solve() : 36 | global grid 37 | for y in range(0, 9): 38 | for x in range(0, 9): 39 | if grid[y][x] == 0: 40 | for n in range(1, 10): 41 | if possible(y, x, n): 42 | grid[y][x] = n 43 | solve() 44 | grid[y][x] = 0 45 | 46 | return 47 | 48 | print(np.matrix(grid)) 49 | 50 | 51 | solve() 52 | print('this is ths sudoku solve') 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /tindog_website/css/styles.css: -------------------------------------------------------------------------------- 1 | 2 | body{ 3 | font-family: 'Montserrat', sans-serif; 4 | 5 | } 6 | 7 | #title { 8 | background-color: #ff4c68; 9 | color: #fff 10 | } 11 | 12 | h1{ 13 | font-family: 'Montserrat', sans-serif; 14 | font-size: 3.5rem; 15 | line-height: 1.5; 16 | } 17 | 18 | h2{ 19 | font-family: 'Montserrat-bold', sans-serif; 20 | font-size: 3rem; 21 | line-height: 1.5; 22 | } 23 | 24 | h3{ 25 | font-family: 'Montserrat-bold', sans-serif; 26 | 27 | } 28 | 29 | p{ 30 | color: #8f8f8f; 31 | } 32 | 33 | .container-fluid{ 34 | padding: 3% 15% 7%; 35 | 36 | } 37 | 38 | .navbar{ 39 | padding-bottom: 0 0 4.5rem; 40 | } 41 | 42 | .navbar-brand{ 43 | font-family: "Ubuntu"; 44 | font-size: 2.5rem; 45 | font-weight: bold; 46 | } 47 | 48 | .nav-item{ 49 | padding: 0px 18px; 50 | } 51 | 52 | .nav-link{ 53 | font-size: 1.2rem; 54 | 55 | font-family: 'Montserrat-light', sans-serif; 56 | 57 | } 58 | 59 | .download-button{ 60 | margin: 5% 3% 5% 0; 61 | } 62 | 63 | .title-image{ 64 | width: 60%; 65 | transform: rotate(25deg); 66 | position: absolute; 67 | right: 30%; 68 | } 69 | 70 | 71 | #features{ 72 | padding: 7% 15%; 73 | background-color: #fff; 74 | position: relative; 75 | z-index: 1; 76 | 77 | } 78 | 79 | .feature-box{ 80 | text-align: center; 81 | padding: 5%; 82 | } 83 | 84 | .icon{ 85 | color: #ef8172; 86 | margin-bottom: 1rem; 87 | 88 | } 89 | 90 | .icon:hover{ 91 | 92 | color: #ff4c68; 93 | } 94 | 95 | #testimonials{ 96 | 97 | text-align: center; 98 | background-color: #ef8172; 99 | color: #fff; 100 | } 101 | .carousel-item{ 102 | padding: 7% 15%; 103 | } 104 | 105 | .testimonials-image{ 106 | width: 10%; 107 | border-radius: 100%; 108 | margin: 20px; 109 | 110 | } 111 | 112 | #press{ 113 | 114 | background-color: #ef8172; 115 | text-align: center; 116 | padding-bottom: 3%; 117 | } 118 | 119 | #cta{ 120 | background-color: #ef8172; 121 | } 122 | 123 | .press-logo{ 124 | width: 15%; 125 | margin: 20px 20px 50px; 126 | } 127 | 128 | #pricing{ 129 | padding: 100px; 130 | text-align: center; 131 | 132 | } 133 | .pricing-column{ 134 | padding 3% 2%; 135 | 136 | } 137 | 138 | #cta{ 139 | text-align: center; 140 | background-color: #ff4c68; 141 | color: #fff; 142 | padding: 7% 15%; 143 | } 144 | 145 | .cta-h3{ 146 | 147 | font-family: 'Montserrat-Black', sans-serif; 148 | font-size: 3.5rem; 149 | font-weight: bold; 150 | } 151 | 152 | #footer{ 153 | padding: 7% 15%; 154 | text-align: center; 155 | } 156 | 157 | .social{ 158 | margin: 20px 10px; 159 | } 160 | 161 | 162 | @media (max-width: 1028px){ 163 | 164 | #title{ 165 | text-align: center; 166 | 167 | } 168 | .title-image{ 169 | position: static; 170 | transform: rotate(0deg); 171 | } 172 | 173 | } -------------------------------------------------------------------------------- /tindog_website/images/TechCrunch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/tindog_website/images/TechCrunch.png -------------------------------------------------------------------------------- /tindog_website/images/bizinsider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/tindog_website/images/bizinsider.png -------------------------------------------------------------------------------- /tindog_website/images/dog-img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/tindog_website/images/dog-img.jpg -------------------------------------------------------------------------------- /tindog_website/images/iphone6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/tindog_website/images/iphone6.png -------------------------------------------------------------------------------- /tindog_website/images/lady-img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/tindog_website/images/lady-img.jpg -------------------------------------------------------------------------------- /tindog_website/images/liav_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/tindog_website/images/liav_image.jpg -------------------------------------------------------------------------------- /tindog_website/images/mashable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/tindog_website/images/mashable.png -------------------------------------------------------------------------------- /tindog_website/images/tnw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/tindog_website/images/tnw.png -------------------------------------------------------------------------------- /tindog_website/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | TinDog 7 | 9 | 10 | 13 | 16 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 28 |
29 |
30 | 31 | 32 | 33 | 53 | 54 | 55 | 56 | 57 |
58 |
59 |

Meet new and interesting dogs nearby.

60 | 63 | 66 |
67 | 68 | 69 |
70 | iphone-mockup 71 |
72 |
73 |
74 | 75 |
76 | 77 | 78 | 79 | 80 |
81 |
82 |
83 | 84 |

Easy to use.

85 |

So easy to use, even your dog could do it.

86 | 87 |
88 | 89 |
90 | 91 |

Elite Clientele

92 |

We have all the dogs, the greatest dogs.

93 |
94 |
95 | 96 |

Guaranteed to work.

97 |

Find the love of your dog's life or your money back.

98 |
99 | 100 |
101 | 102 | 103 |
104 | 105 | 106 | 107 | 108 |
109 | 110 | 111 | 138 | 139 | 140 |
141 | 142 | 143 | 144 | 145 |
146 | 147 | 148 | 149 | 150 | 151 |
152 | 153 | 154 | 155 | 156 |
157 | 158 |

A Plan for Every Dog's Needs

159 |

Simple and affordable price plans for your and your dog.

160 | 161 |
162 | 163 |
164 |
165 |
166 |

Chihuahua

167 |
168 |
169 |

Free

170 |

5 Matches Per Day

171 |

10 Messages Per Day

172 |

Unlimited App Usage

173 | 174 |
175 | 176 |
177 | 178 |
179 | 180 |
181 |
182 |
183 |

Labrador

184 |
185 |
186 | 187 |

$49 / mo

188 |

Unlimited Matches

189 |

Unlimited Messages

190 |

Unlimited App Usage

191 | 192 |
193 | 194 |
195 | 196 | 197 |
198 | 199 |
200 |
201 |
202 |

Mastiff

203 |
204 |
205 |

$99 / mo

206 |

Pirority Listing

207 |

Unlimited Matches

208 |

Unlimited Messages

209 |

Unlimited App Usage

210 | 211 |
212 | 213 |
214 | 215 |
216 | 217 | 218 |
219 |
220 | 221 | 222 | 223 | 224 |
225 | 226 |

Find the True Love of Your Dog's Life Today.

227 | 230 | 233 | 234 |
235 | 236 | 237 | 238 | 239 | 248 | 249 | 250 | 251 | 252 | 253 | -------------------------------------------------------------------------------- /turtle_projects/clock_turtle_program.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | from datetime import datetime 3 | 4 | FONT_TEXT = ("Verdana", 15, "normal") 5 | UP = 90 6 | DOWN = 270 7 | RIGHT = 0 8 | LEFT = 180 9 | ANGLE_DIFFERENCE_BETWEEN_HOUR = 30 10 | ANGLE_DIFFERENCE_BETWEEN_MINUTE = 6 11 | CLOCK_RADUIS = 250 12 | NUM_HOUR = 12 13 | SMALL_HAND_LEN = 100 14 | BIG_HAND_LEN = 150 15 | hour_dict = {1: 60, 2: 30, 3: 360, 4: 330, 5: 300, 6: 270, 7: 240, 8: 210, 9: 180, 10: 150, 11: 130, 12: 90} 16 | 17 | # Clock object 18 | clock = turtle.Turtle() 19 | # Screen object 20 | screen = turtle.Screen() 21 | # Small hand clock object 22 | clock_small_hand = turtle.Turtle() 23 | # Big hand clock object 24 | clock_big_hand = turtle.Turtle() 25 | # Time 26 | current_time = datetime 27 | 28 | 29 | def main(): 30 | # Turtle object 31 | turtle.title("liron clock program") 32 | turtle.hideturtle() 33 | turtle.penup() 34 | turtle.setheading(UP) 35 | turtle.fd(280) 36 | turtle.write("liron_clock_program", font=FONT_TEXT, align='center') 37 | 38 | clock.speed('fastest') 39 | clock.hideturtle() 40 | 41 | screen.tracer() 42 | 43 | clock_small_hand.color("red") 44 | clock_small_hand.pensize(10) 45 | clock_small_hand.shape('arrow') 46 | 47 | clock_big_hand.color("black") 48 | clock_big_hand.pensize(10) 49 | clock_big_hand.shape("arrow") 50 | 51 | # Make body of the clock 52 | clock.pensize(10) 53 | clock.pencolor("black") 54 | clock.penup() 55 | clock.setheading(DOWN) 56 | clock.fd(250) 57 | clock.pendown() 58 | clock.setheading(0) 59 | for num in range(NUM_HOUR * 5): 60 | if num % 5 == 0: 61 | clock.setheading(clock.heading() + UP) 62 | clock.fd(80) 63 | clock.bk(80) 64 | clock.setheading(clock.heading() - UP) 65 | clock.circle(CLOCK_RADUIS, ANGLE_DIFFERENCE_BETWEEN_HOUR / 5) 66 | else: 67 | clock.setheading(clock.heading() + UP) 68 | clock.fd(50) 69 | clock.bk(50) 70 | clock.setheading(clock.heading() - UP) 71 | clock.circle(CLOCK_RADUIS, ANGLE_DIFFERENCE_BETWEEN_HOUR / 5) 72 | 73 | while True: 74 | set_minute = calclute_hading_min() 75 | update_time(set_minute) 76 | screen.update() 77 | 78 | turtle.exitonclick() 79 | 80 | 81 | def calclute_hading_min() -> None: 82 | return 90 - (current_time.now().minute / 60) * 360 83 | 84 | 85 | def update_time(hading_minute: int) -> None: 86 | # Make hand of clock 87 | clock_small_hand.clear() 88 | clock_big_hand.clear() 89 | if current_time.now().hour % NUM_HOUR == 0: 90 | clock_small_hand.setheading(hour_dict[NUM_HOUR]) 91 | clock_big_hand.setheading(hading_minute) 92 | else: 93 | clock_small_hand.setheading(hour_dict[current_time.now().hour % NUM_HOUR]) 94 | clock_big_hand.setheading(hading_minute) 95 | clock_small_hand.fd(SMALL_HAND_LEN) 96 | clock_small_hand.bk(SMALL_HAND_LEN) 97 | clock_big_hand.fd(BIG_HAND_LEN) 98 | clock_big_hand.bk(BIG_HAND_LEN) 99 | 100 | 101 | if __name__ == "__main__": 102 | main() 103 | -------------------------------------------------------------------------------- /turtle_projects/hirst_jpg.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/turtle_projects/hirst_jpg.webp -------------------------------------------------------------------------------- /turtle_projects/liron_draw_program.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import random 3 | 4 | color_list = ["blue", "green", "red", "cyan", "magenta", "yellow", "black", "white"] 5 | screen = turtle.Screen() 6 | pen_size = 2 7 | TURTLE_STEP = 40 8 | 9 | 10 | def main(): 11 | change_pen_size(0) 12 | turtle.speed("fastest") 13 | turtle.title("liron draw program") 14 | turtle.write("liron_draw_program", font=("Verdana", 15, "normal"), align='center') 15 | print(""" 16 | hii, welcome to liron draw program! the keys are: 17 | 'w' - forward 18 | 's' - 'backward 19 | 'd' - clock_wise 20 | 'a' - counter clock wise 21 | 'p' - change color 22 | 'f' - increase pen size 23 | 'g' - decrease pen size 24 | 'c' - clear screen""") 25 | 26 | screen.listen() 27 | screen.onkey(fun=lambda: turtle.fd(40), key="w") 28 | screen.onkey(fun=lambda: turtle.fd(-40), key="s") 29 | screen.onkey(fun=lambda: turtle.left(15), key="d") 30 | screen.onkey(fun=lambda: turtle.right(15), key="a") 31 | screen.onkey(fun=turtle.clear, key="c") 32 | screen.onkey(fun=change_color, key="p") 33 | screen.onkey(fun=lambda: change_pen_size(1), key="f") 34 | screen.onkey(fun=lambda: change_pen_size(-1), key="g") 35 | 36 | screen.exitonclick() 37 | 38 | 39 | def change_color() -> None: 40 | turtle.pencolor(random.choice(color_list)) 41 | 42 | 43 | def change_pen_size(size_change: int) -> None: 44 | global pen_size 45 | pen_size += size_change 46 | if (pen_size <= 0): 47 | pen_size = 1 48 | turtle.shapesize(int(pen_size / 2 + 0.5)) 49 | turtle.pensize(pen_size) 50 | 51 | 52 | if __name__ == "__main__": 53 | main() 54 | -------------------------------------------------------------------------------- /turtle_projects/liron_hirst_panting.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import random 3 | 4 | color_list = [(202, 164, 109), (238, 240, 245), (150, 75, 49), (223, 201, 135), (52, 93, 124), (172, 154, 40), 5 | (140, 30, 19), (133, 163, 185), (198, 91, 71), (46, 122, 86), (72, 43, 35), (145, 178, 148), 6 | (13, 99, 71), (233, 175, 164), (161, 142, 158), (105, 74, 77), (55, 46, 50), (183, 205, 171), 7 | (36, 60, 74), (18, 86, 90), (81, 148, 129), (148, 17, 20), (14, 70, 64), (30, 68, 100), 8 | (107, 127, 153), (174, 94, 97), (176, 192, 209)] 9 | 10 | def main(): 11 | turtle.title("liron hirst program") 12 | turtle.colormode(255) 13 | turtle.speed("fastest") 14 | turtle.penup() 15 | turtle.hideturtle() 16 | turtle.setheading(225) 17 | turtle.forward(300) 18 | turtle.setheading(0) 19 | number_of_dots = 100 20 | 21 | for dot_count in range(1, number_of_dots + 1): 22 | turtle.dot(20, random.choice(color_list)) 23 | turtle.forward(50) 24 | if dot_count % 10 == 0: 25 | turtle.setheading(90) 26 | turtle.forward(50) 27 | turtle.setheading(180) 28 | turtle.forward(500) 29 | turtle.setheading(0) 30 | screen = turtle.Screen() 31 | screen.exitonclick() 32 | 33 | if __name__ == "__main__": 34 | main() -------------------------------------------------------------------------------- /turtle_projects/liron_spirograph.py: -------------------------------------------------------------------------------- 1 | import random 2 | import turtle 3 | 4 | color_list = ["blue", "green", "red", "cyan", "magenta", "yellow", "black", "white"] 5 | 6 | 7 | def main(): 8 | turtle.speed(1000) 9 | s = turtle.Screen() 10 | turtle.title("liron_spirograph") 11 | draw_spirograph(2) 12 | 13 | 14 | def draw_spirograph(tilt: int) -> None: 15 | for _ in range(int(360 / tilt)): 16 | turtle.color(random.choice(color_list)) 17 | turtle.circle(100) 18 | turtle.setheading(turtle.heading() + tilt) 19 | 20 | turtle.exitonclick() 21 | 22 | 23 | if __name__ == "__main__": 24 | main() 25 | -------------------------------------------------------------------------------- /turtle_projects/liron_turtle_game.py: -------------------------------------------------------------------------------- 1 | import random 2 | import turtle 3 | 4 | player_one = turtle.Turtle() 5 | player_two = turtle.Turtle() 6 | 7 | 8 | def main(): 9 | 10 | 11 | s = turtle.Screen() 12 | turtle.title("liron_race_game") 13 | turtle.write("race game:", font=("Verdana", 15, "normal"), align='center') 14 | turtle.hideturtle() 15 | start_position_turtle() 16 | make_circles() 17 | player_turn = 0 18 | while chack_state_turtle(): 19 | p = player_turn % 2 20 | if p == 0: 21 | die_outcome = game_input_user(p + 1) 22 | player_one.fd(20 * die_outcome) 23 | else: 24 | die_outcome = game_input_user(p + 1) 25 | player_two.fd(20 * die_outcome) 26 | player_turn += 1 27 | 28 | turtle.exitonclick() 29 | 30 | def game_input_user(num_player: int) -> int: 31 | # take user input 32 | turtle.textinput("promt ", F"player {num_player} enter roll to roll the dice") 33 | die_outcome = random.randint(1, 6) 34 | return die_outcome 35 | 36 | 37 | def chack_state_turtle() -> bool: 38 | # chack if turtle is got to final place 39 | if player_one.pos()[0] >= 300: 40 | print("player 1 win!") 41 | return False 42 | elif player_two.pos()[0] >= 300: 43 | print("player 2 win!") 44 | return False 45 | return True 46 | 47 | 48 | def start_position_turtle() -> None: 49 | # starting point 50 | player_one.color("red") 51 | player_one.shape("turtle") 52 | player_one.penup() 53 | player_one.goto(-200, 100) 54 | player_two.color("blue") 55 | player_two.shape("turtle") 56 | player_two.penup() 57 | player_two.goto(-200, -100) 58 | 59 | 60 | def make_circles() -> None: 61 | # make circles 62 | player_one.speed(20) 63 | player_one.goto(300, 60) 64 | player_one.pendown() 65 | player_one.begin_fill() 66 | player_one.circle(40) 67 | player_one.end_fill() 68 | player_one.penup() 69 | player_one.goto(-200, 100) 70 | player_two.speed(20) 71 | player_two.goto(300, -140) 72 | player_two.pendown() 73 | player_two.begin_fill() 74 | player_two.circle(40) 75 | player_two.end_fill() 76 | player_two.penup() 77 | player_two.goto(-200, -100) 78 | 79 | 80 | if __name__ == "__main__": 81 | main() 82 | -------------------------------------------------------------------------------- /turtle_projects/lliron_turtle_race_game.py: -------------------------------------------------------------------------------- 1 | import turtle as turtle_module 2 | import random 3 | 4 | turtle = turtle_module.Turtle() 5 | turtle1 = turtle_module.Turtle() 6 | turtle2 = turtle_module.Turtle() 7 | turtle3 = turtle_module.Turtle() 8 | turtle4 = turtle_module.Turtle() 9 | 10 | color_list = ["blue", "green", "red", "cyan", "magenta"] 11 | turtle_list = [turtle, turtle1, turtle2, turtle3, turtle4] 12 | turtle_forward_list = [10, 40, 60, 200, 5, 12, 56, 3, 7, 22, 77, 33, 88, 57, 125] 13 | 14 | 15 | def main(): 16 | turtle_module.title("liron race program") 17 | screen = turtle_module.Screen() 18 | screen.setup(width=1200, height=400) 19 | turtle_module.write("liron_race_program", font=("Verdana", 15, "normal"), align='center') 20 | set_turtles_starting_position() 21 | player_guss = turtle_module.textinput("guess_area ", "enter which turtle you think will win the game") 22 | 23 | winning_turtle = turtle1 24 | is_game_on = True 25 | while is_game_on: 26 | rand_turtle = random.choice(turtle_list) 27 | rand_turtle.fd(random.choice(turtle_forward_list)) 28 | if rand_turtle.xcor() > 560: 29 | is_game_on = False 30 | winning_turtle = rand_turtle 31 | 32 | if player_guss.lower() == str(winning_turtle.pencolor()).lower(): 33 | print("you win!!") 34 | else: 35 | print(F"you lose the wining turtle is the {winning_turtle.pencolor()}") 36 | 37 | turtle_module.exitonclick() 38 | 39 | 40 | def set_turtles_starting_position() -> None: 41 | y_pos = 50 42 | for index, tur_object in enumerate(turtle_list): 43 | tur_object.color(color_list[index]) 44 | tur_object.penup() 45 | tur_object.shapesize(2) 46 | tur_object.shape("turtle") 47 | tur_object.goto(-560, y_pos*index -90 ) 48 | 49 | 50 | if __name__ == "__main__": 51 | main() 52 | -------------------------------------------------------------------------------- /turtle_projects/project/__pycache__/car_manger.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/turtle_projects/project/__pycache__/car_manger.cpython-310.pyc -------------------------------------------------------------------------------- /turtle_projects/project/__pycache__/player.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/turtle_projects/project/__pycache__/player.cpython-310.pyc -------------------------------------------------------------------------------- /turtle_projects/project/__pycache__/scoreboard.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/turtle_projects/project/__pycache__/scoreboard.cpython-310.pyc -------------------------------------------------------------------------------- /turtle_projects/project/car_manger.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | import random 3 | COLORS = ["red", "orange", "yellow", "green", "blue", "purple"] 4 | STARTING_MOVE_DISTANCE = 5 5 | MOVE_INCREMENT = 30 6 | 7 | 8 | class CarManager(): 9 | 10 | def __init__(self): 11 | super().__init__() 12 | self.all_cars = [] 13 | self.car_speed = STARTING_MOVE_DISTANCE 14 | 15 | def create_car(self): 16 | random_chance = random.randint(1,6) 17 | if random_chance == 1: 18 | new_car = Turtle("square") 19 | new_car.shapesize(stretch_wid=1,stretch_len=2) 20 | new_car.penup() 21 | new_car.color(random.choice(COLORS)) 22 | random_y = random.randint(-250,250) 23 | new_car.goto(300, random_y) 24 | self.all_cars.append(new_car) 25 | 26 | def move_cars(self): 27 | for car in self.all_cars: 28 | car.backward(STARTING_MOVE_DISTANCE) 29 | 30 | def level_up(self): 31 | self.car_speed += MOVE_INCREMENT 32 | 33 | 34 | -------------------------------------------------------------------------------- /turtle_projects/project/main.py: -------------------------------------------------------------------------------- 1 | import time 2 | from turtle import Screen 3 | from player import Player 4 | from car_manger import CarManager 5 | from scoreboard import Scoreboard 6 | 7 | screen = Screen() 8 | screen.setup(width=600, height=600) 9 | screen.tracer(0) 10 | 11 | screen.listen() 12 | 13 | player = Player() 14 | car_manager = CarManager() 15 | score_board = Scoreboard() 16 | screen.onkey(player.go_up, "Up") 17 | game_is_on = True 18 | while game_is_on: 19 | 20 | time.sleep(0.1) 21 | screen.update() 22 | 23 | car_manager.create_car() 24 | car_manager.move_cars() 25 | 26 | #Detect collision with car 27 | for car in car_manager.all_cars: 28 | if car.distance(player) < 20: 29 | game_is_on = False 30 | score_board.game_over() 31 | 32 | if player.is_at_finish_line(): 33 | player.go_to_start() 34 | car_manager.level_up() 35 | score_board.update_level() 36 | 37 | 38 | screen.exitonclick() -------------------------------------------------------------------------------- /turtle_projects/project/player.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | 3 | STARTING_POSITION = (0, -280) 4 | MOVE_DISTANCE = 10 5 | FINISH_LINE_Y = 280 6 | 7 | 8 | class Player(Turtle): 9 | 10 | def __init__(self): 11 | super().__init__() 12 | self.shape("turtle") 13 | self.penup() 14 | self.setheading(90) 15 | self.go_to_start() 16 | 17 | def go_up(self): 18 | self.forward(MOVE_DISTANCE) 19 | 20 | def go_to_start(self): 21 | self.goto(STARTING_POSITION) 22 | 23 | def is_at_finish_line(self): 24 | if self.ycor() > FINISH_LINE_Y: 25 | return True 26 | else: 27 | return False 28 | 29 | -------------------------------------------------------------------------------- /turtle_projects/project/scoreboard.py: -------------------------------------------------------------------------------- 1 | from tkinter.font import Font 2 | from turtle import Turtle 3 | FONT = ("Courier", 24, "normal") 4 | 5 | 6 | class Scoreboard(Turtle): 7 | 8 | def __init__(self): 9 | super().__init__() 10 | self.level = 1 11 | self.hideturtle() 12 | self.penup() 13 | self.goto(-280, 250) 14 | self.update_scoreboard() 15 | 16 | def update_scoreboard(self): 17 | self.clear() 18 | self.write(f"Level: {self.level}", font=FONT, align="left") 19 | 20 | def update_level(self): 21 | self.level += 1 22 | self.update_scoreboard() 23 | 24 | def game_over(self): 25 | self.goto(0,0) 26 | self.write("Game Over", align="center", font=FONT) 27 | 28 | -------------------------------------------------------------------------------- /us_states_game/50_states.csv: -------------------------------------------------------------------------------- 1 | state,x,y 2 | Alabama,139,-77 3 | Alaska,-204,-170 4 | Arizona,-203,-40 5 | Arkansas,57,-53 6 | California,-297,13 7 | Colorado,-112,20 8 | Connecticut,297,96 9 | Delaware,275,42 10 | Florida,220,-145 11 | Georgia,182,-75 12 | Hawaii,-317,-143 13 | Idaho,-216,122 14 | Illinois,95,37 15 | Indiana,133,39 16 | Iowa,38,65 17 | Kansas,-17,5 18 | Kentucky,149,1 19 | Louisiana,59,-114 20 | Maine,319,164 21 | Maryland,288,27 22 | Massachusetts,312,112 23 | Michigan,148,101 24 | Minnesota,23,135 25 | Mississippi,94,-78 26 | Missouri,49,6 27 | Montana,-141,150 28 | Nebraska,-61,66 29 | Nevada,-257,56 30 | New Hampshire,302,127 31 | New Jersey,282,65 32 | New Mexico,-128,-43 33 | New York,236,104 34 | North Carolina,239,-22 35 | North Dakota,-44,158 36 | Ohio,176,52 37 | Oklahoma,-8,-41 38 | Oregon,-278,138 39 | Pennsylvania,238,72 40 | Rhode Island,318,94 41 | South Carolina,218,-51 42 | South Dakota,-44,109 43 | Tennessee,131,-34 44 | Texas,-38,-106 45 | Utah,-189,34 46 | Vermont,282,154 47 | Virginia,234,12 48 | Washington,-257,193 49 | West Virginia,200,20 50 | Wisconsin,83,113 51 | Wyoming,-134,90 -------------------------------------------------------------------------------- /us_states_game/blank_states_img.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lironmiz/python_mini_projects/c166858a11d2f24ffd97c3625e216353c363a16a/us_states_game/blank_states_img.gif -------------------------------------------------------------------------------- /us_states_game/main.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import pandas 3 | 4 | # constant in the game 5 | BLANK_STATES_IMAGE_WIDTH = 725 6 | BLANK_STATES_IMAGE_HEIGHT = 495 7 | STATE_FONT = ("Verdana", 7, "normal") 8 | WELL_DONE_FONT = ("Verdana", 40, "normal") 9 | WELL_DONE_X_SPOT = 0 10 | WELL_DONE_Y_SPOT = 0 11 | ALIGN = 'center' 12 | NUM_STATES = 50 13 | X_COLUMN = 1 14 | Y_COLUMN = 2 15 | FIRST_USER_SCORE = 0 16 | WELL_DONE_TEXT = "well done!!" 17 | 18 | pen = turtle.Turtle() 19 | screen = turtle.Screen() 20 | screen.title("liron us states game") 21 | image = "blank_states_img.gif" 22 | screen.addshape(image) 23 | turtle.shape(image) 24 | screen.setup(width=BLANK_STATES_IMAGE_WIDTH, height=BLANK_STATES_IMAGE_HEIGHT) 25 | # making data frame 26 | data = pandas.read_csv("50_states.csv") 27 | # making the state list and lower all the items 28 | data_state_list = data.state.to_list() 29 | data_state_list = [each_state.lower() for each_state in data_state_list] 30 | 31 | 32 | def main(): 33 | user_need_to_learn_list = [] 34 | user_score = FIRST_USER_SCORE 35 | user_right_answer = [] 36 | print("welcome to liron us state game!!! if you done with the game enter 'Exit' ") 37 | while user_score < NUM_STATES: 38 | user_answer = screen.textinput(title=f"{user_score}/50", prompt="what's another state name?") 39 | if user_answer == "Exit": 40 | user_need_to_learn_list = [state for state in data.state if str(state).lower() not in user_right_answer] 41 | data_frame_user_need_to_learn = pandas.DataFrame(user_need_to_learn_list) 42 | data_frame_user_need_to_learn.to_csv("need_to_learn.csv") 43 | break 44 | for index, state in enumerate(data.state): 45 | if str(user_answer).lower() == str(data.iloc[index, 0]).lower() and str( 46 | user_answer).lower() not in user_right_answer: 47 | write_on_screen(data.iloc[index, X_COLUMN], data.iloc[index, Y_COLUMN], user_answer.lower(), STATE_FONT) 48 | user_score += 1 49 | user_right_answer.append(user_answer) 50 | # looping for all the states and checking if the user was right 51 | 52 | if user_score == NUM_STATES: 53 | write_on_screen(WELL_DONE_X_SPOT, WELL_DONE_Y_SPOT, WELL_DONE_TEXT, WELL_DONE_FONT) 54 | turtle.mainloop() 55 | 56 | 57 | def write_on_screen(x_loc: int, y_loc: int, text: str, font: tuple) -> None: 58 | """ 59 | update the score of the users and show to screen 60 | Parameters: x_loc: int - the x coordinate of text, y_loc: int - the y coordinate of text 61 | text: str - the text data, font: tuple - the font style 62 | Returns: None 63 | """ 64 | pen.penup() 65 | pen.hideturtle() 66 | pen.color("black") 67 | pen.goto(x_loc, y_loc) 68 | pen.write(text, font=font, align=ALIGN) 69 | 70 | 71 | if __name__ == "__main__": 72 | main() 73 | -------------------------------------------------------------------------------- /us_states_game/need_to_learn.csv: -------------------------------------------------------------------------------- 1 | ,0 2 | 0,Alabama 3 | 1,Arizona 4 | 2,Arkansas 5 | 3,California 6 | 4,Colorado 7 | 5,Connecticut 8 | 6,Delaware 9 | 7,Florida 10 | 8,Georgia 11 | 9,Hawaii 12 | 10,Idaho 13 | 11,Illinois 14 | 12,Indiana 15 | 13,Iowa 16 | 14,Kansas 17 | 15,Kentucky 18 | 16,Louisiana 19 | 17,Maine 20 | 18,Maryland 21 | 19,Massachusetts 22 | 20,Michigan 23 | 21,Minnesota 24 | 22,Mississippi 25 | 23,Missouri 26 | 24,Montana 27 | 25,Nebraska 28 | 26,Nevada 29 | 27,New Hampshire 30 | 28,New Jersey 31 | 29,New Mexico 32 | 30,North Carolina 33 | 31,North Dakota 34 | 32,Ohio 35 | 33,Oklahoma 36 | 34,Oregon 37 | 35,Pennsylvania 38 | 36,Rhode Island 39 | 37,South Carolina 40 | 38,South Dakota 41 | 39,Tennessee 42 | 40,Texas 43 | 41,Utah 44 | 42,Vermont 45 | 43,Virginia 46 | 44,Washington 47 | 45,West Virginia 48 | 46,Wisconsin 49 | 47,Wyoming 50 | --------------------------------------------------------------------------------