28 |
├── Day 1 ├── Band Name Generator │ └── main.py ├── Exercise │ ├── exercise1.py │ └── exercise2.py ├── print.py └── variable.py ├── Day 10 ├── Calculator │ ├── art.py │ └── main.py ├── Exercises │ └── exercise1.py └── funcoutput.py ├── Day 11 └── Blackjack │ ├── art.py │ └── main.py ├── Day 12 ├── The Number Guessing Game │ ├── art.py │ └── main.py └── scope.py ├── Day 14 └── Higher Lower Game │ ├── art.py │ ├── game_data.py │ └── main.py ├── Day 15 └── Coffee Machine │ ├── main.py │ └── menu.py ├── Day 16 ├── Coffee Machine (OOP) │ ├── coffee_maker.py │ ├── main.py │ ├── menu.py │ └── money_machine.py └── clsobj.py ├── Day 17 ├── Quiz Project │ ├── data.py │ ├── main.py │ ├── question_model.py │ └── quiz_brain.py └── ownclass.py ├── Day 18 ├── Exercises │ ├── exercise1.py │ ├── exercise2.py │ ├── exercise3.py │ ├── exercise4.py │ └── exercise5.py ├── The Hirst Painting │ ├── image.jpg │ └── main.py └── turtgraph.py ├── Day 19 ├── Exercises │ └── exercise1.py ├── Turtle Race │ └── main.py └── highfunc.py ├── Day 2 ├── Exercise │ ├── exercise1.py │ ├── exercise2.py │ └── exercise3.py ├── Tip Calculator │ └── main.py ├── datatypes.py ├── fstring.py └── mathoperators.py ├── Day 20-21 ├── Snake Game │ ├── food.py │ ├── main.py │ ├── scoreboard.py │ └── snake.py └── inhert.py ├── Day 22 └── Pong │ ├── ball.py │ ├── main.py │ ├── paddle.py │ └── scoreboard.py ├── Day 23 └── Turtle Crossing Game │ ├── car_manager.py │ ├── main.py │ ├── player.py │ └── scoreboard.py ├── Day 24 ├── Mail Merge │ ├── Input │ │ ├── Letters │ │ │ └── starting_letter.txt │ │ └── Names │ │ │ └── invited_names.txt │ ├── Output │ │ └── ReadyToSend │ │ │ ├── letter_for_Aang.txt │ │ │ ├── letter_for_Appa.txt │ │ │ ├── letter_for_Katara.txt │ │ │ ├── letter_for_Momo.txt │ │ │ ├── letter_for_Sokka.txt │ │ │ ├── letter_for_Toph.txt │ │ │ ├── letter_for_Uncle Iroh.txt │ │ │ └── letter_for_Zuko.txt │ └── main.py ├── Snake Game │ ├── data.txt │ ├── food.py │ ├── main.py │ ├── scoreboard.py │ └── snake.py ├── files.py ├── my_file.txt └── new_my_file.txt ├── Day 25 ├── 2018_Central_Park_Squirrel_Census_-_Squirrel_Data.csv ├── Turkey States Game │ ├── 81_states.csv │ ├── main.py │ ├── states_to_learn.csv │ └── turkey_states.gif ├── U.S. States Game │ ├── 50_states.csv │ ├── blank_states_img.gif │ ├── main.py │ └── states_to_learn.csv ├── new_data.csv ├── pand.py ├── squirrel.py ├── squirrel_count.csv └── weather_data.csv ├── Day 26 ├── Exercises │ ├── exercise.py │ ├── exercise2.py │ ├── exercise3.py │ ├── exercise4.py │ ├── exercise5.py │ ├── file1.txt │ └── file2.txt ├── NATO Alphabet │ ├── main.py │ └── nato_phonetic_alphabet.csv ├── U.S. States Game │ ├── 50_states.csv │ ├── blank_states_img.gif │ ├── main.py │ └── states_to_learn.csv ├── comp.py └── itera.py ├── Day 27 ├── Mile To Kilometers Converter │ └── main.py ├── button_entry_comp.py ├── kwar.py ├── layout.py ├── widgets.py └── win_label.py ├── Day 28 └── Pomodoro Timer │ ├── main.py │ └── tomato.png ├── Day 29 └── Password Generator │ ├── data.txt │ ├── logo.png │ └── main.py ├── Day 3 ├── Exercise │ ├── exercise1.py │ ├── exercise2.py │ ├── exercise3.py │ ├── exercise4.py │ └── exercise5.py ├── Treasure Island │ └── main.py └── if_else.py ├── Day 30 ├── Exercises │ ├── exercise.py │ └── exercise2.py ├── NATO Alphabet │ ├── main.py │ └── nato_phonetic_alphabet.csv ├── Password Generator │ ├── data.txt │ ├── logo.png │ └── main.py ├── a_file.txt └── exceptions.py ├── Day 31 └── Flash Cards │ ├── data │ └── turkish_words.csv │ ├── images │ ├── card_back.png │ ├── card_front.png │ ├── right.png │ └── wrong.png │ └── main.py ├── Day 32 ├── Automated Birthday Wisher │ ├── birthdays.csv │ ├── letter_templates │ │ ├── letter_1.txt │ │ ├── letter_2.txt │ │ └── letter_3.txt │ └── main.py ├── Email - Motivational Quotes │ ├── main.py │ └── quotes.txt └── dateti.py ├── Day 33 ├── ISS Overhead Notifier │ └── main.py ├── Kanye Rest API │ ├── background.png │ ├── kanye.png │ └── main.py ├── api_parameters.py └── responses.py ├── Day 34 └── Quizzler │ ├── data.py │ ├── images │ ├── false.png │ └── true.png │ ├── main.py │ ├── question_model.py │ ├── quiz_brain.py │ └── ui.py ├── Day 35 └── Send SMS - Weather │ └── main.py ├── Day 36 └── Stock Trading News Alert Project │ └── main.py ├── Day 37 └── Habit Tracker │ └── main.py ├── Day 4 ├── Exercise │ ├── exercise1.py │ ├── exercise2.py │ └── exercise3.py ├── Rock Paper Scissors │ └── main.py ├── list_lesson.py └── random_lesson.py ├── Day 41-44 ├── css │ └── style.css ├── favicon │ └── favicon.ico ├── images │ ├── burak.png │ ├── chillies.png │ ├── cloud.png │ ├── computer-modified.png │ ├── computer.png │ ├── mountain.png │ └── screen-2-modified.png └── index.html ├── Day 45 ├── The 100 Greatest Movies │ ├── main.py │ └── movies.txt ├── beasoup.py ├── liveweb.py └── website.html ├── Day 47 └── Automated Amazon Price Tracker │ └── main.py ├── Day 48 ├── Exercises │ ├── exercise.py │ └── exercise2.py ├── The Cookie Clicker │ └── main.py ├── fillingclicking.py └── setup.py ├── Day 5 ├── Create a Password Generator │ └── main.py ├── Exercise │ ├── exercise1.py │ ├── exercise2.py │ ├── exercise3.py │ └── exercise4.py ├── forloop.py └── rangefunc.py ├── Day 51 └── Twitter Bot │ └── main.py ├── Day 52 └── Instagram Follower Bot │ └── main.py ├── Day 56 - 2 └── Name Card │ ├── main.py │ ├── static │ ├── assets │ │ ├── css │ │ │ ├── fontawesome-all.min.css │ │ │ ├── images │ │ │ │ ├── bg.jpg │ │ │ │ └── overlay.png │ │ │ ├── main.css │ │ │ └── noscript.css │ │ ├── js │ │ │ ├── breakpoints.min.js │ │ │ ├── browser.min.js │ │ │ ├── jquery.min.js │ │ │ ├── main.js │ │ │ └── util.js │ │ ├── sass │ │ │ ├── libs │ │ │ │ ├── _breakpoints.scss │ │ │ │ ├── _functions.scss │ │ │ │ ├── _html-grid.scss │ │ │ │ ├── _mixins.scss │ │ │ │ ├── _vars.scss │ │ │ │ └── _vendor.scss │ │ │ ├── main.scss │ │ │ └── noscript.scss │ │ └── webfonts │ │ │ ├── fa-brands-400.eot │ │ │ ├── fa-brands-400.svg │ │ │ ├── fa-brands-400.ttf │ │ │ ├── fa-brands-400.woff │ │ │ ├── fa-brands-400.woff2 │ │ │ ├── fa-regular-400.eot │ │ │ ├── fa-regular-400.svg │ │ │ ├── fa-regular-400.ttf │ │ │ ├── fa-regular-400.woff │ │ │ ├── fa-regular-400.woff2 │ │ │ ├── fa-solid-900.eot │ │ │ ├── fa-solid-900.svg │ │ │ ├── fa-solid-900.ttf │ │ │ ├── fa-solid-900.woff │ │ │ └── fa-solid-900.woff2 │ └── images │ │ └── profilepicture.jpg │ └── templates │ └── index.html ├── Day 56 ├── main.py ├── static │ ├── assets │ │ └── css │ │ │ └── style.css │ └── images │ │ ├── burak.png │ │ ├── cloud.png │ │ ├── computer-modified.png │ │ ├── mountain.png │ │ └── screen-2-modified.png └── templates │ └── index.html ├── Day 57 2 └── Blog Capstone Project Part1 │ ├── main.py │ ├── post.py │ ├── static │ └── css │ │ └── styles.css │ └── templates │ ├── index.html │ └── post.html ├── Day 57 ├── main.py └── templates │ ├── blog.html │ ├── guess.html │ └── index.html ├── Day 58 └── TinDog │ ├── css │ └── styles.css │ ├── images │ ├── TechCrunch.png │ ├── bizinsider.png │ ├── dog-img.jpg │ ├── iphone6.png │ ├── lady-img.jpg │ ├── mashable.png │ └── tnw.png │ └── index.html ├── Day 59 └── Blog Capstone Project Part 2 │ ├── main.py │ ├── static │ ├── assets │ │ ├── favicon.ico │ │ └── img │ │ │ ├── about-bg.jpg │ │ │ ├── contact-bg.jpg │ │ │ ├── home-bg.jpg │ │ │ ├── post-bg.jpg │ │ │ └── post-sample-image.jpg │ ├── css │ │ └── styles.css │ └── js │ │ └── scripts.js │ └── templates │ ├── about.html │ ├── contact.html │ ├── footer.html │ ├── header.html │ ├── index.html │ └── post.html ├── Day 6 └── functions.py ├── Day 60 2 └── Blog Capstone Project Part 2 │ ├── main.py │ ├── static │ ├── assets │ │ ├── favicon.ico │ │ └── img │ │ │ ├── about-bg.jpg │ │ │ ├── contact-bg.jpg │ │ │ ├── home-bg.jpg │ │ │ ├── post-bg.jpg │ │ │ └── post-sample-image.jpg │ ├── css │ │ └── styles.css │ └── js │ │ └── scripts.js │ └── templates │ ├── about.html │ ├── contact.html │ ├── footer.html │ ├── header.html │ ├── index.html │ └── post.html ├── Day 60 ├── main.py └── templates │ └── index.html ├── Day 61 ├── main.py └── templates │ ├── base.html │ ├── denied.html │ ├── index.html │ ├── login.html │ └── success.html ├── Day 62 └── Coffee & Wifi Project │ ├── cafe-data.csv │ ├── main.py │ ├── static │ └── css │ │ └── styles.css │ └── templates │ ├── add.html │ ├── cafes.html │ └── index.html ├── Day 63 └── Virtual Bookshelf │ ├── books.db │ ├── main.py │ └── templates │ ├── add.html │ ├── edit_rating.html │ └── index.html ├── Day 64 └── My Top 10 Movies │ ├── main.py │ ├── movies.db │ ├── static │ └── css │ │ └── styles.css │ └── templates │ ├── add.html │ ├── edit.html │ ├── index.html │ └── select.html ├── Day 66 └── Cafe RESTful API │ ├── cafes.db │ ├── main.py │ └── templates │ └── index.html ├── Day 67 └── Blog Capstone Project Part 3 │ ├── main.py │ ├── posts.db │ ├── static │ ├── css │ │ ├── clean-blog.css │ │ └── clean-blog.min.css │ ├── img │ │ ├── about-bg.jpg │ │ ├── contact-bg.jpg │ │ └── edit-bg.jpg │ ├── js │ │ ├── clean-blog.js │ │ ├── clean-blog.min.js │ │ ├── contact_me.js │ │ └── jqBootstrapValidation.js │ ├── scss │ │ ├── _bootstrap-overrides.scss │ │ ├── _contact.scss │ │ ├── _footer.scss │ │ ├── _global.scss │ │ ├── _masthead.scss │ │ ├── _mixins.scss │ │ ├── _navbar.scss │ │ ├── _post.scss │ │ ├── _variables.scss │ │ └── clean-blog.scss │ └── vendor │ │ ├── bootstrap │ │ ├── css │ │ │ ├── bootstrap-grid.css │ │ │ ├── bootstrap-grid.css.map │ │ │ ├── bootstrap-grid.min.css │ │ │ ├── bootstrap-grid.min.css.map │ │ │ ├── bootstrap-reboot.css │ │ │ ├── bootstrap-reboot.css.map │ │ │ ├── bootstrap-reboot.min.css │ │ │ ├── bootstrap-reboot.min.css.map │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ └── js │ │ │ ├── bootstrap.bundle.js │ │ │ ├── bootstrap.bundle.js.map │ │ │ ├── bootstrap.bundle.min.js │ │ │ ├── bootstrap.bundle.min.js.map │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.js.map │ │ │ ├── bootstrap.min.js │ │ │ └── bootstrap.min.js.map │ │ ├── fontawesome-free │ │ ├── css │ │ │ ├── all.css │ │ │ ├── all.min.css │ │ │ ├── brands.css │ │ │ ├── brands.min.css │ │ │ ├── fontawesome.css │ │ │ ├── fontawesome.min.css │ │ │ ├── regular.css │ │ │ ├── regular.min.css │ │ │ ├── solid.css │ │ │ ├── solid.min.css │ │ │ ├── svg-with-js.css │ │ │ ├── svg-with-js.min.css │ │ │ ├── v4-shims.css │ │ │ └── v4-shims.min.css │ │ └── webfonts │ │ │ ├── fa-brands-400.eot │ │ │ ├── fa-brands-400.svg │ │ │ ├── fa-brands-400.woff │ │ │ ├── fa-brands-400.woff2 │ │ │ ├── fa-regular-400.svg │ │ │ ├── fa-regular-400.ttf │ │ │ ├── fa-regular-400.woff │ │ │ ├── fa-regular-400.woff2 │ │ │ ├── fa-solid-900.eot │ │ │ ├── fa-solid-900.svg │ │ │ ├── fa-solid-900.ttf │ │ │ ├── fa-solid-900.woff │ │ │ └── fa-solid-900.woff2 │ │ └── jquery │ │ ├── jquery.js │ │ ├── jquery.min.js │ │ ├── jquery.min.map │ │ ├── jquery.slim.js │ │ ├── jquery.slim.min.js │ │ └── jquery.slim.min.map │ └── templates │ ├── about.html │ ├── contact.html │ ├── footer.html │ ├── header.html │ ├── index.html │ ├── make-post.html │ └── post.html ├── Day 69 └── Blog Capstone Project │ ├── blog.db │ ├── forms.py │ ├── main.py │ ├── static │ ├── css │ │ ├── clean-blog.css │ │ └── clean-blog.min.css │ ├── img │ │ ├── about-bg.jpg │ │ ├── contact-bg.jpg │ │ ├── edit-bg.jpg │ │ └── home-bg.jpg │ ├── js │ │ ├── clean-blog.js │ │ ├── clean-blog.min.js │ │ ├── contact_me.js │ │ └── jqBootstrapValidation.js │ ├── scss │ │ ├── _bootstrap-overrides.scss │ │ ├── _contact.scss │ │ ├── _footer.scss │ │ ├── _global.scss │ │ ├── _masthead.scss │ │ ├── _mixins.scss │ │ ├── _navbar.scss │ │ ├── _post.scss │ │ ├── _variables.scss │ │ └── clean-blog.scss │ └── vendor │ │ ├── bootstrap │ │ ├── css │ │ │ ├── bootstrap-grid.css │ │ │ ├── bootstrap-grid.css.map │ │ │ ├── bootstrap-grid.min.css │ │ │ ├── bootstrap-grid.min.css.map │ │ │ ├── bootstrap-reboot.css │ │ │ ├── bootstrap-reboot.css.map │ │ │ ├── bootstrap-reboot.min.css │ │ │ ├── bootstrap-reboot.min.css.map │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ └── js │ │ │ ├── bootstrap.bundle.js │ │ │ ├── bootstrap.bundle.js.map │ │ │ ├── bootstrap.bundle.min.js │ │ │ ├── bootstrap.bundle.min.js.map │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.js.map │ │ │ ├── bootstrap.min.js │ │ │ └── bootstrap.min.js.map │ │ ├── fontawesome-free │ │ ├── css │ │ │ ├── all.css │ │ │ ├── all.min.css │ │ │ ├── brands.css │ │ │ ├── brands.min.css │ │ │ ├── fontawesome.css │ │ │ ├── fontawesome.min.css │ │ │ ├── regular.css │ │ │ ├── regular.min.css │ │ │ ├── solid.css │ │ │ ├── solid.min.css │ │ │ ├── svg-with-js.css │ │ │ ├── svg-with-js.min.css │ │ │ ├── v4-shims.css │ │ │ └── v4-shims.min.css │ │ └── webfonts │ │ │ ├── fa-brands-400.eot │ │ │ ├── fa-brands-400.svg │ │ │ ├── fa-brands-400.woff │ │ │ ├── fa-brands-400.woff2 │ │ │ ├── fa-regular-400.svg │ │ │ ├── fa-regular-400.ttf │ │ │ ├── fa-regular-400.woff │ │ │ ├── fa-regular-400.woff2 │ │ │ ├── fa-solid-900.eot │ │ │ ├── fa-solid-900.svg │ │ │ ├── fa-solid-900.ttf │ │ │ ├── fa-solid-900.woff │ │ │ └── fa-solid-900.woff2 │ │ └── jquery │ │ ├── jquery.js │ │ ├── jquery.min.js │ │ ├── jquery.min.map │ │ ├── jquery.slim.js │ │ ├── jquery.slim.min.js │ │ └── jquery.slim.min.map │ └── templates │ ├── about.html │ ├── contact.html │ ├── footer.html │ ├── header.html │ ├── index.html │ ├── login.html │ ├── make-post.html │ ├── post.html │ └── register.html ├── Day 7 ├── hangman.py ├── hangman_art.py └── hangman_words.py ├── Day 71 ├── Data Exploration Pandas College Major.ipynb ├── Highest Paying Jobs With a Bachelor’s Degree │ ├── highest_paying_jobs.csv │ └── main.py └── salaries_by_college_major.csv ├── Day 72 ├── Programming_Languages.ipynb └── QueryResults.csv ├── Day 73 ├── Lego Analysis.ipynb ├── assets │ ├── bricks.jpg │ ├── lego_sets.png │ ├── lego_themes.png │ └── rebrickable_schema.png └── data │ ├── colors.csv │ ├── sets.csv │ └── themes.csv ├── Day 74 ├── Bitcoin Search Trend.csv ├── Daily Bitcoin Price.csv ├── Google Trends and Data Visualisation.ipynb ├── TESLA Search Trend vs Price.csv ├── UE Benefits Search vs UE Rate 2004-19.csv └── UE Benefits Search vs UE Rate 2004-20.csv ├── Day 75 ├── Google Play Store App Analytics.ipynb └── apps.csv ├── Day 76 ├── Computation_with_NumPy_and_N_Dimensional_Arrays.ipynb └── yummy_macarons.jpg ├── Day 77 ├── Seaborn_and_Linear_Regression.ipynb └── cost_revenue_dirty.csv ├── Day 78 ├── Nobel_Prize_Analysis.ipynb └── nobel_prize_data.csv ├── Day 79 ├── Dr_Semmelweis_Handwashing_Discovery.ipynb ├── annual_deaths_by_clinic.csv └── monthly_deaths.csv ├── Day 8 ├── Caesar Cipher │ ├── art.py │ └── main.py ├── Exercises │ ├── exercise1.py │ └── exercise2.py └── funcinputs.py ├── Day 80 ├── Multivariable_Regression_and_Valuation_Model.ipynb └── boston.csv └── Day 9 ├── Exercises ├── exercise1.py └── exercise2.py ├── Secret Auction ├── art.py └── main.py ├── dictes.py └── nesting.py /Day 1/Band Name Generator/main.py: -------------------------------------------------------------------------------- 1 | print("Welcome to the Band Name Generator") 2 | 3 | city = input("What's name of the city you grew up in?\n") 4 | petName = input("What's your pet's name?\n") 5 | 6 | print("Your band name could be " + city + " " + petName) -------------------------------------------------------------------------------- /Day 1/Exercise/exercise1.py: -------------------------------------------------------------------------------- 1 | #Write a program that prints the number of characters in a user's name. You might need to Google for a function that calculates the length of a string. 2 | 3 | isim = input("What is your name?") 4 | print(len(isim)) -------------------------------------------------------------------------------- /Day 1/Exercise/exercise2.py: -------------------------------------------------------------------------------- 1 | # 🚨 Don't change the code below 👇 2 | a = input("a: ") 3 | b = input("b: ") 4 | # 🚨 Don't change the code above 👆 5 | 6 | #################################### 7 | #Write your code below this line 👇 8 | a, b = b, a 9 | #Write your code above this line 👆 10 | #################################### 11 | 12 | # 🚨 Don't change the code below 👇 13 | print("a: " + a) 14 | print("b: " + b) -------------------------------------------------------------------------------- /Day 1/print.py: -------------------------------------------------------------------------------- 1 | print("Hello World") -------------------------------------------------------------------------------- /Day 1/variable.py: -------------------------------------------------------------------------------- 1 | name = input("What is your name?") 2 | print(name) -------------------------------------------------------------------------------- /Day 10/Calculator/art.py: -------------------------------------------------------------------------------- 1 | logo = """ 2 | _____________________ 3 | | _________________ | 4 | | | Pythonista 0. | | .----------------. .----------------. .----------------. .----------------. 5 | | |_________________| | | .--------------. || .--------------. || .--------------. || .--------------. | 6 | | ___ ___ ___ ___ | | | ______ | || | __ | || | _____ | || | ______ | | 7 | | | 7 | 8 | 9 | | + | | | | .' ___ | | || | / \ | || | |_ _| | || | .' ___ | | | 8 | | |___|___|___| |___| | | | / .' \_| | || | / /\ \ | || | | | | || | / .' \_| | | 9 | | | 4 | 5 | 6 | | - | | | | | | | || | / ____ \ | || | | | _ | || | | | | | 10 | | |___|___|___| |___| | | | \ `.___.'\ | || | _/ / \ \_ | || | _| |__/ | | || | \ `.___.'\ | | 11 | | | 1 | 2 | 3 | | x | | | | `._____.' | || ||____| |____|| || | |________| | || | `._____.' | | 12 | | |___|___|___| |___| | | | | || | | || | | || | | | 13 | | | . | 0 | = | | / | | | '--------------' || '--------------' || '--------------' || '--------------' | 14 | | |___|___|___| |___| | '----------------' '----------------' '----------------' '----------------' 15 | |_____________________| 16 | """ -------------------------------------------------------------------------------- /Day 10/Calculator/main.py: -------------------------------------------------------------------------------- 1 | import art 2 | 3 | def add(a,b): 4 | return a + b 5 | 6 | def subtract(a,b): 7 | return a - b 8 | 9 | def multiply(a,b): 10 | return a * b 11 | 12 | def divide(a,b): 13 | return a / b 14 | 15 | print(art.logo) 16 | 17 | first_number = float(input("What's the first number?: ")) 18 | print("+") 19 | print("-") 20 | print("*") 21 | print("/") 22 | 23 | while True: 24 | equals = int() 25 | operation = input("Pick an operation: ") 26 | second_number = float(input("What's the next number?: ")) 27 | last_number = second_number 28 | 29 | if operation == "+": 30 | equals = add(first_number,second_number) 31 | print(f"{first_number} {operation} {second_number} = {equals}") 32 | elif operation == "-": 33 | equals = subtract(first_number,second_number) 34 | print(f"{first_number} {operation} {second_number} = {equals}") 35 | elif operation == "*": 36 | equals = multiply(first_number, second_number) 37 | print(f"{first_number} {operation} {second_number} = {equals}") 38 | elif operation == "/": 39 | equals = divide(first_number, second_number) 40 | print(f"{first_number} {operation} {second_number} = {equals}") 41 | else: 42 | print("Please type your operation right.") 43 | continue 44 | 45 | y_n = input(f"Type 'y' to continue calculating with {equals}, or type 'n' to start a new calculation: ") 46 | if y_n == "n": 47 | print("Bye") 48 | break 49 | elif y_n == "y": 50 | first_number = equals 51 | continue 52 | 53 | -------------------------------------------------------------------------------- /Day 10/Exercises/exercise1.py: -------------------------------------------------------------------------------- 1 | def is_leap(year): 2 | if year % 4 == 0: 3 | if year % 100 == 0: 4 | if year % 400 == 0: 5 | return True 6 | else: 7 | return False 8 | else: 9 | return True 10 | else: 11 | return False 12 | 13 | 14 | def days_in_month(year, month): 15 | month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] 16 | if month > 12 or month < 1: 17 | return "Invalid month" 18 | elif is_leap(year) and month == 2: 19 | return 29 20 | return month_days[month - 1] 21 | 22 | 23 | # 🚨 Do NOT change any of the code below 24 | year = int(input("Enter a year: ")) 25 | month = int(input("Enter a month: ")) 26 | days = days_in_month(year, month) 27 | 28 | print(days) -------------------------------------------------------------------------------- /Day 10/funcoutput.py: -------------------------------------------------------------------------------- 1 | def format_name(f_name,l_name): 2 | if f_name == "" or l_name == "": 3 | return "You didn't provide valid inputs" 4 | formated_f_name = f_name.title() 5 | formated_l_name = l_name.title() 6 | return f"{formated_f_name} {formated_l_name}" 7 | 8 | print(format_name(input("What is your first name?"), input("What is your last name?"))) -------------------------------------------------------------------------------- /Day 11/Blackjack/art.py: -------------------------------------------------------------------------------- 1 | logo = """ 2 | .------. _ _ _ _ _ 3 | |A_ _ |. | | | | | | (_) | | 4 | |( \/ ).-----. | |__ | | __ _ ___| | ___ __ _ ___| | __ 5 | | \ /|K /\ | | '_ \| |/ _` |/ __| |/ / |/ _` |/ __| |/ / 6 | | \/ | / \ | | |_) | | (_| | (__| <| | (_| | (__| < 7 | `-----| \ / | |_.__/|_|\__,_|\___|_|\_\ |\__,_|\___|_|\_\\ 8 | | \/ K| _/ | 9 | `------' |__/ 10 | """ -------------------------------------------------------------------------------- /Day 12/The Number Guessing Game/art.py: -------------------------------------------------------------------------------- 1 | logo = """ 2 | _______ ___. ________ .__ ________ 3 | \ \ __ __ _____\_ |__ ___________ / _____/ __ __ ____ ______ _____|__| ____ ____ / _____/_____ _____ ____ 4 | / | \| | \/ \| __ \_/ __ \_ __ \ / \ ___| | \_/ __ \ / ___// ___/ |/ \ / ___\ / \ ___\__ \ / \_/ __ \ 5 | / | \ | / Y Y \ \_\ \ ___/| | \/ \ \_\ \ | /\ ___/ \___ \ \___ \| | | \/ /_/ > \ \_\ \/ __ \| Y Y \ ___/ 6 | \____|__ /____/|__|_| /___ /\___ >__| \______ /____/ \___ >____ >____ >__|___| /\___ / \______ (____ /__|_| /\___ > 7 | \/ \/ \/ \/ \/ \/ \/ \/ \//_____/ \/ \/ \/ \/ 8 | """ -------------------------------------------------------------------------------- /Day 12/The Number Guessing Game/main.py: -------------------------------------------------------------------------------- 1 | import random 2 | import art 3 | 4 | print(art.logo) 5 | print("Welcome to the Number Guessing Game!") 6 | print("I'm thinking of a number between 1 and 100.") 7 | number = random.randint(1,100) 8 | easy_hard = input("Choose a difficulty. Type 'easy' or 'hard': ").lower() 9 | lives = 10 10 | 11 | if easy_hard == "hard": 12 | lives = 5 13 | print("You have 5 attempts remaining to guess the number.") 14 | else: 15 | print("You have 10 attempts remaining to guess the number.") 16 | 17 | while True: 18 | if lives == 0: 19 | print("You've run out of guesses, you lose.") 20 | break 21 | guess = int(input("Make a guess: ")) 22 | if guess == number: 23 | print(f"You got it! The answer was {number}") 24 | break 25 | elif guess < number: 26 | print("Too low") 27 | print("Guess again") 28 | lives -= 1 29 | print(f"You have {lives} attempts remaining to guess the number.") 30 | elif guess > number: 31 | print("Too high") 32 | print("Guess again") 33 | lives -= 1 34 | print(f"You have {lives} attempts remaining to guess the number.") 35 | 36 | -------------------------------------------------------------------------------- /Day 12/scope.py: -------------------------------------------------------------------------------- 1 | # enemies = 1 2 | # 3 | # def increase_enemies(): 4 | # enemies = 2 5 | # print(f"enemies inside function: {enemies}") 6 | # 7 | # increase_enemies() 8 | # 9 | # print(f"enemies outside function: {enemies}") 10 | # 11 | # #local scope 12 | # def drink_potion(): 13 | # potion_strength = 2 14 | # print(potion_strength) 15 | 16 | #global scope 17 | # player_health = 10 18 | # def drink_potion(): 19 | # potion_strength = 2 20 | # print(player_health) 21 | # 22 | # drink_potion() 23 | 24 | enemies = 1 25 | 26 | def increase_enemies(): 27 | global enemies 28 | enemies += 1 29 | print(f"enemies inside function: {enemies}") 30 | 31 | increase_enemies() 32 | print(f"enemies outside function: {enemies}") -------------------------------------------------------------------------------- /Day 14/Higher Lower Game/art.py: -------------------------------------------------------------------------------- 1 | logo = """ 2 | __ ___ __ 3 | / / / (_)___ _/ /_ ___ _____ 4 | / /_/ / / __ `/ __ \/ _ \/ ___/ 5 | / __ / / /_/ / / / / __/ / 6 | /_/ ///_/\__, /_/ /_/\___/_/ 7 | / / /____/_ _____ _____ 8 | / / / __ \ | /| / / _ \/ ___/ 9 | / /___/ /_/ / |/ |/ / __/ / 10 | /_____/\____/|__/|__/\___/_/ 11 | """ 12 | 13 | vs = """ 14 | _ __ 15 | | | / /____ 16 | | | / / ___/ 17 | | |/ (__ ) 18 | |___/____(_) 19 | """ -------------------------------------------------------------------------------- /Day 14/Higher Lower Game/main.py: -------------------------------------------------------------------------------- 1 | import art 2 | import game_data 3 | import random 4 | 5 | score = 0 6 | 7 | while True: 8 | print(art.logo) 9 | 10 | comperaA = random.choice(game_data.data) 11 | againstB = random.choice(game_data.data) 12 | if comperaA == againstB: 13 | againstB = random.choice(game_data.data) 14 | 15 | print(f"Compare A: {comperaA['name']}, {comperaA['description']}, from {comperaA['country']}") 16 | print(art.vs) 17 | print(f"Against B: {againstB['name']}, {againstB['description']}, from {againstB['country']}") 18 | 19 | question = input("Who has more followers? Type 'A' or 'B': ") 20 | 21 | if question == "A" and comperaA["follower_count"] > againstB["follower_count"]: 22 | score += 1 23 | elif question == "B" and comperaA["follower_count"] < againstB["follower_count"]: 24 | score += 1 25 | else: 26 | print(f"Sorry, that's wrong. Final score: {score}") 27 | break 28 | 29 | print(f"You're right! Current score: {score}") -------------------------------------------------------------------------------- /Day 15/Coffee Machine/menu.py: -------------------------------------------------------------------------------- 1 | MENU = { 2 | "espresso": { 3 | "ingredients": { 4 | "water": 50, 5 | "coffee": 18, 6 | }, 7 | "cost": 1.5, 8 | }, 9 | "latte": { 10 | "ingredients": { 11 | "water": 200, 12 | "milk": 150, 13 | "coffee": 24, 14 | }, 15 | "cost": 2.5, 16 | }, 17 | "cappuccino": { 18 | "ingredients": { 19 | "water": 250, 20 | "milk": 100, 21 | "coffee": 24, 22 | }, 23 | "cost": 3.0, 24 | } 25 | } 26 | profit = 0 27 | resources = { 28 | "water": 300, 29 | "milk": 200, 30 | "coffee": 100, 31 | } 32 | -------------------------------------------------------------------------------- /Day 16/Coffee Machine (OOP)/coffee_maker.py: -------------------------------------------------------------------------------- 1 | class CoffeeMaker: 2 | """Models the machine that makes the coffee""" 3 | def __init__(self): 4 | self.resources = { 5 | "water": 300, 6 | "milk": 200, 7 | "coffee": 100, 8 | } 9 | 10 | def report(self): 11 | """Prints a report of all resources.""" 12 | print(f"Water: {self.resources['water']}ml") 13 | print(f"Milk: {self.resources['milk']}ml") 14 | print(f"Coffee: {self.resources['coffee']}g") 15 | 16 | def is_resource_sufficient(self, drink): 17 | """Returns True when order can be made, False if ingredients are insufficient.""" 18 | can_make = True 19 | for item in drink.ingredients: 20 | if drink.ingredients[item] > self.resources[item]: 21 | print(f"Sorry there is not enough {item}.") 22 | can_make = False 23 | return can_make 24 | 25 | def make_coffee(self, order): 26 | """Deducts the required ingredients from the resources.""" 27 | for item in order.ingredients: 28 | self.resources[item] -= order.ingredients[item] 29 | print(f"Here is your {order.name} ☕️. Enjoy!") 30 | -------------------------------------------------------------------------------- /Day 16/Coffee Machine (OOP)/main.py: -------------------------------------------------------------------------------- 1 | from menu import Menu 2 | from coffee_maker import CoffeeMaker 3 | from money_machine import MoneyMachine 4 | 5 | money_machine = MoneyMachine() 6 | coffee_maker = CoffeeMaker() 7 | menu = Menu() 8 | 9 | is_on = True 10 | 11 | while is_on: 12 | options = menu.get_items() 13 | choice = input(f"What would you like? ({options}): ") 14 | if choice == "off": 15 | is_on = False 16 | elif choice == "report": 17 | coffee_maker.report() 18 | money_machine.report() 19 | else: 20 | drink = menu.find_drink(choice) 21 | if coffee_maker.is_resource_sufficient(drink) and money_machine.make_payment(drink.cost): 22 | coffee_maker.make_coffee(drink) 23 | 24 | 25 | -------------------------------------------------------------------------------- /Day 16/Coffee Machine (OOP)/menu.py: -------------------------------------------------------------------------------- 1 | class MenuItem: 2 | """Models each Menu Item.""" 3 | def __init__(self, name, water, milk, coffee, cost): 4 | self.name = name 5 | self.cost = cost 6 | self.ingredients = { 7 | "water": water, 8 | "milk": milk, 9 | "coffee": coffee 10 | } 11 | 12 | 13 | class Menu: 14 | """Models the Menu with drinks.""" 15 | def __init__(self): 16 | self.menu = [ 17 | MenuItem(name="latte", water=200, milk=150, coffee=24, cost=2.5), 18 | MenuItem(name="espresso", water=50, milk=0, coffee=18, cost=1.5), 19 | MenuItem(name="cappuccino", water=250, milk=50, coffee=24, cost=3), 20 | ] 21 | 22 | def get_items(self): 23 | """Returns all the names of the available menu items""" 24 | options = "" 25 | for item in self.menu: 26 | options += f"{item.name}/" 27 | return options 28 | 29 | def find_drink(self, order_name): 30 | """Searches the menu for a particular drink by name. Returns that item if it exists, otherwise returns None""" 31 | for item in self.menu: 32 | if item.name == order_name: 33 | return item 34 | print("Sorry that item is not available.") 35 | -------------------------------------------------------------------------------- /Day 16/Coffee Machine (OOP)/money_machine.py: -------------------------------------------------------------------------------- 1 | class MoneyMachine: 2 | CURRENCY = "$" 3 | 4 | COIN_VALUES = { 5 | "quarters": 0.25, 6 | "dimes": 0.10, 7 | "nickles": 0.05, 8 | "pennies": 0.01 9 | } 10 | 11 | def __init__(self): 12 | self.profit = 0 13 | self.money_received = 0 14 | 15 | def report(self): 16 | """Prints the current profit""" 17 | print(f"Money: {self.CURRENCY}{self.profit}") 18 | 19 | def process_coins(self): 20 | """Returns the total calculated from coins inserted.""" 21 | print("Please insert coins.") 22 | for coin in self.COIN_VALUES: 23 | self.money_received += int(input(f"How many {coin}?: ")) * self.COIN_VALUES[coin] 24 | return self.money_received 25 | 26 | def make_payment(self, cost): 27 | """Returns True when payment is accepted, or False if insufficient.""" 28 | self.process_coins() 29 | if self.money_received >= cost: 30 | change = round(self.money_received - cost, 2) 31 | print(f"Here is {self.CURRENCY}{change} in change.") 32 | self.profit += cost 33 | self.money_received = 0 34 | return True 35 | else: 36 | print("Sorry that's not enough money. Money refunded.") 37 | self.money_received = 0 38 | return False 39 | 40 | -------------------------------------------------------------------------------- /Day 16/clsobj.py: -------------------------------------------------------------------------------- 1 | # from turtle import Turtle,Screen 2 | # 3 | # timmy = Turtle() 4 | # print(timmy) 5 | # timmy.shape("turtle") 6 | # timmy.color("coral") 7 | # timmy.forward(100) 8 | # 9 | # my_screen = Screen() 10 | # print(my_screen.canvheight) 11 | # my_screen.exitonclick() 12 | 13 | from prettytable import PrettyTable 14 | 15 | table = PrettyTable() 16 | 17 | table.add_column("Pokemon Name",["Pikachu","Squirtle","Charmander"]) 18 | table.add_column("Type",["Electric","Water","Fire"]) 19 | table.align ="r" 20 | print(table) -------------------------------------------------------------------------------- /Day 17/Quiz Project/main.py: -------------------------------------------------------------------------------- 1 | from question_model import Question 2 | from data import question_data 3 | from quiz_brain import QuizBrain 4 | 5 | questions = [] 6 | for q in question_data: 7 | category = q["category"] 8 | type = q["type"] 9 | difficulty = q["difficulty"] 10 | question_text = q["question"] 11 | question_answer = q["correct_answer"] 12 | incorrect_answer = q["incorrect_answers"] 13 | new_question = Question(category, type, difficulty, question_text, question_answer, incorrect_answer) 14 | questions.append(new_question) 15 | 16 | quiz = QuizBrain(questions) 17 | 18 | while quiz.has_questions(): 19 | quiz.next_question() 20 | 21 | print("You've completed the quiz.") 22 | print(f"Your final score: {quiz.score}/{quiz.q_number}") -------------------------------------------------------------------------------- /Day 17/Quiz Project/question_model.py: -------------------------------------------------------------------------------- 1 | class Question: 2 | def __init__(self,category, type, difficulty, question_text, question_answer, incorrect_answer): 3 | self.category = category 4 | self.type = type 5 | self.difficulty = difficulty 6 | self.text = question_text 7 | self.answer = question_answer 8 | self.incorrect_answer = incorrect_answer -------------------------------------------------------------------------------- /Day 17/Quiz Project/quiz_brain.py: -------------------------------------------------------------------------------- 1 | class QuizBrain: 2 | def __init__(self,question_list): 3 | self.q_number = 0 4 | self.q_list = question_list 5 | self.score = 0 6 | 7 | def has_questions(self): 8 | if self.q_number < len(self.q_list): 9 | return True 10 | return False 11 | 12 | def next_question(self): 13 | question = self.q_list[self.q_number] 14 | self.q_number += 1 15 | answer = input(f"Q.{self.q_number}: {question.text} (True/False): ") 16 | self.check(answer, question.answer) 17 | 18 | def check(self,answer, correct_answer): 19 | if answer.lower() == correct_answer.lower(): 20 | self.score += 1 21 | print("You got it right!") 22 | else: 23 | print("That's wrong.") 24 | print(f"The correct answer was: {correct_answer}.") 25 | print(f"Your current score: {self.score}/{self.q_number}") 26 | print("\n") 27 | 28 | -------------------------------------------------------------------------------- /Day 17/ownclass.py: -------------------------------------------------------------------------------- 1 | class User: 2 | def __init__(self,user_id,username): 3 | self.id = user_id 4 | self.username = username 5 | self.followers = 0 6 | self.following = 0 7 | 8 | def follow(self, user): 9 | user.followers += 1 10 | self.following += 1 11 | 12 | user_1 = User("001","burak") 13 | user_2 = User("002","atmaca") 14 | 15 | user_1.follow(user_2) 16 | 17 | print(user_1.followers) 18 | print(user_1.following) 19 | print(user_2.followers) 20 | print(user_2.following) -------------------------------------------------------------------------------- /Day 18/Exercises/exercise1.py: -------------------------------------------------------------------------------- 1 | #####Turtle Intro###### 2 | import turtle as t 3 | 4 | tim = t.Turtle() 5 | 6 | 7 | ######## Challenge 1 - Draw a Square ############ 8 | for x in range(4): 9 | tim.forward(100) 10 | tim.right(90) 11 | 12 | screen = t.Screen() 13 | screen.exitonclick() 14 | 15 | -------------------------------------------------------------------------------- /Day 18/Exercises/exercise2.py: -------------------------------------------------------------------------------- 1 | import turtle as t 2 | 3 | tim = t.Turtle() 4 | 5 | ########### Challenge 2 - Draw a Dashed Line ######## 6 | for x in range(10): 7 | tim.pendown() 8 | tim.forward(20) 9 | tim.penup() 10 | tim.forward(20) 11 | 12 | screen = t.Screen() 13 | screen.exitonclick() 14 | -------------------------------------------------------------------------------- /Day 18/Exercises/exercise3.py: -------------------------------------------------------------------------------- 1 | import turtle as t 2 | import random 3 | 4 | tim = t.Turtle() 5 | 6 | ########### Challenge 3 - Draw Shapes ######## 7 | deg = 360 8 | shape_corners = 3 9 | colors = ["blue","red","black","green","yellow","darkGreen","DeepSkyBlue"] 10 | while shape_corners < 10: 11 | tim.color(random.choice(colors)) 12 | for x in range(shape_corners): 13 | tim.right(deg / shape_corners) 14 | tim.forward(100) 15 | shape_corners += 1 16 | 17 | 18 | screen = t.Screen() 19 | screen.exitonclick() -------------------------------------------------------------------------------- /Day 18/Exercises/exercise4.py: -------------------------------------------------------------------------------- 1 | import turtle as t 2 | import random 3 | 4 | tim = t.Turtle() 5 | 6 | ########### Challenge 4 - Random Walk ######## 7 | def random_color(): 8 | r = random.randint(0, 255) 9 | g = random.randint(0, 255) 10 | b = random.randint(0, 255) 11 | random_color = (r, g, b) 12 | return random_color 13 | 14 | walk = 0 15 | tim.pensize(15) 16 | tim.speed("fastest") 17 | t.colormode(255) 18 | 19 | while walk < 100: 20 | turn = random.choice([0,90,180,270]) 21 | tim.color(random_color()) 22 | tim.forward(30) 23 | tim.setheading(turn) 24 | walk += 1 25 | 26 | screen = t.Screen() 27 | screen.exitonclick() -------------------------------------------------------------------------------- /Day 18/Exercises/exercise5.py: -------------------------------------------------------------------------------- 1 | import turtle as t 2 | import random 3 | 4 | tim = t.Turtle() 5 | t.colormode(255) 6 | def random_color(): 7 | r = random.randint(0, 255) 8 | g = random.randint(0, 255) 9 | b = random.randint(0, 255) 10 | color = (r, g, b) 11 | return color 12 | 13 | turrn = 0 14 | tim.speed("fastest") 15 | ########### Challenge 5 - Spirograph ######## 16 | while turrn < 100: 17 | current_heading = tim.heading() 18 | tim.setheading(current_heading + 5) 19 | tim.color(random_color()) 20 | tim.circle(100) 21 | current_heading += tim.heading() 22 | turrn += 1 23 | 24 | 25 | screen = t.Screen() 26 | screen.exitonclick() -------------------------------------------------------------------------------- /Day 18/The Hirst Painting/image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 18/The Hirst Painting/image.jpg -------------------------------------------------------------------------------- /Day 18/The Hirst Painting/main.py: -------------------------------------------------------------------------------- 1 | # import colorgram 2 | # from PIL import * 3 | # 4 | # rgb_colors = [] 5 | # colors = colorgram.extract('image.jpg', 30) 6 | # for color in colors: 7 | # r = color.rgb.r 8 | # g = color.rgb.g 9 | # b = color.rgb.b 10 | # new_color = (r, g, b) 11 | # rgb_colors.append(new_color) 12 | # 13 | # print(rgb_colors) 14 | 15 | import turtle as t 16 | import random 17 | 18 | color_list = [(245, 243, 238), (247, 242, 244), (240, 245, 241), (202, 164, 109), (238, 240, 245), (150, 75, 49), 19 | (223, 201, 135), (52, 93, 124), (172, 154, 40), (140, 30, 19), (133, 163, 185), (198, 91, 71), 20 | (46, 122, 86), (72, 43, 35), (145, 178, 148), (13, 99, 71), (233, 175, 164), (161, 142, 158), 21 | (105, 74, 77), (55, 46, 50), (183, 205, 171), (36, 60, 74), (18, 86, 90), (81, 148, 129), (148, 17, 20), 22 | (14, 70, 64), (30, 68, 100), (107, 127, 153), (174, 94, 97), (176, 192, 209)] 23 | 24 | tim = t.Turtle() 25 | t.colormode(255) 26 | 27 | tim.penup() 28 | tim.speed("fastest") 29 | tim.setheading(225) 30 | tim.forward(300) 31 | tim.setheading(0) 32 | 33 | dots = 100 34 | for x in range(1, dots + 1): 35 | tim.dot(20,random.choice(color_list)) 36 | tim.forward(50) 37 | if x % 10 == 0: 38 | tim.setheading(90) 39 | tim.forward(50) 40 | tim.setheading(180) 41 | tim.forward(500) 42 | tim.setheading(0) 43 | 44 | screen = t.Screen() 45 | screen.exitonclick() 46 | -------------------------------------------------------------------------------- /Day 18/turtgraph.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle, Screen 2 | 3 | timmy_the_turtle = Turtle() 4 | timmy_the_turtle.shape("turtle") 5 | timmy_the_turtle.color("red") 6 | timmy_the_turtle.forward(100) 7 | timmy_the_turtle.right(90) 8 | 9 | screen = Screen() 10 | screen.exitonclick() -------------------------------------------------------------------------------- /Day 19/Exercises/exercise1.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle, Screen 2 | 3 | tim = Turtle() 4 | 5 | def move_forwards(): 6 | tim.forward(10) 7 | 8 | def move_backwards(): 9 | tim.backward(10) 10 | 11 | def move_right(): 12 | tim.right(10) 13 | 14 | def move_left(): 15 | tim.left(10) 16 | 17 | def clear_screen(): 18 | tim.clear() 19 | tim.penup() 20 | tim.home() 21 | tim.pendown() 22 | 23 | screen = Screen() 24 | screen.listen() 25 | screen.onkeypress(key = "w", fun = move_forwards) 26 | screen.onkeypress(key = "s", fun = move_backwards) 27 | screen.onkeypress(key = "a", fun = move_left) 28 | screen.onkeypress(key = "d", fun = move_right) 29 | screen.onkeypress(key = "space", fun = clear_screen) 30 | 31 | screen.exitonclick() 32 | -------------------------------------------------------------------------------- /Day 19/Turtle Race/main.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | from turtle import Turtle, Screen 3 | import random 4 | from tkinter import messagebox 5 | 6 | root = tkinter.messagebox 7 | 8 | screen = Screen() 9 | screen.setup(width = 500, height = 400) 10 | screen.title("Turtle Race") 11 | 12 | user_choice = screen.textinput(title = "Make your bet", prompt = "Which turtle will win the race? Enter a color (red, orange, yellow, green, blue, purple): ") 13 | 14 | colors = ["red","orange","yellow","green","blue","purple"] 15 | y_pos = [-80, -50, -20, 10 , 40 , 70] 16 | all_turtles = [] 17 | 18 | for x in range(0,6): 19 | new_turtle = Turtle(shape ="turtle") 20 | new_turtle.color(colors[x]) 21 | new_turtle.penup() 22 | new_turtle.goto(x = -230, y = y_pos[x]) 23 | all_turtles.append(new_turtle) 24 | 25 | on_race = False 26 | 27 | if user_choice: 28 | on_race = True 29 | 30 | while on_race: 31 | for x in all_turtles: 32 | if x.xcor() > 230: 33 | on_race = False 34 | winner = x.pencolor() 35 | if winner == user_choice: 36 | root.showinfo(title="Race Finished", message=f"You've won! The {winner} turtle is the winner!") 37 | else: 38 | root.showinfo(title="Race Finished", message=f"You've lost! The {winner} turtle is the winner!") 39 | random_forward = random.randint(0, 10) 40 | x.forward(random_forward) 41 | 42 | screen.exitonclick() -------------------------------------------------------------------------------- /Day 19/highfunc.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle, Screen 2 | 3 | tim = Turtle() 4 | 5 | def move_forwards(): 6 | tim.forward(10) 7 | 8 | def move_backwards(): 9 | tim.backward(10) 10 | 11 | def move_right(): 12 | tim.right(10) 13 | 14 | def move_left(): 15 | tim.left(10) 16 | 17 | def clear_screen(): 18 | tim.clear() 19 | tim.penup() 20 | tim.home() 21 | tim.pendown() 22 | 23 | screen = Screen() 24 | screen.listen() 25 | screen.onkeypress(key = "w", fun = move_forwards) 26 | screen.onkeypress(key = "s", fun = move_backwards) 27 | screen.onkeypress(key = "a", fun = move_left) 28 | screen.onkeypress(key = "d", fun = move_right) 29 | screen.onkeypress(key = "space", fun = clear_screen) 30 | 31 | screen.exitonclick() 32 | -------------------------------------------------------------------------------- /Day 2/Exercise/exercise1.py: -------------------------------------------------------------------------------- 1 | # 🚨 Don't change the code below 👇 2 | two_digit_number = input("Type a two digit number: ") 3 | # 🚨 Don't change the code above 👆 4 | 5 | #################################### 6 | #Write your code below this line 👇 7 | 8 | print(int(two_digit_number[0]) + int(two_digit_number[1])) -------------------------------------------------------------------------------- /Day 2/Exercise/exercise2.py: -------------------------------------------------------------------------------- 1 | # 🚨 Don't change the code below 👇 2 | height = float(input("enter your height in m: ")) 3 | weight = int(input("enter your weight in kg: ")) 4 | # 🚨 Don't change the code above 👆 5 | 6 | #Write your code below this line 👇 7 | print(int(weight / (height * height))) -------------------------------------------------------------------------------- /Day 2/Exercise/exercise3.py: -------------------------------------------------------------------------------- 1 | # 🚨 Don't change the code below 👇 2 | age = int(input("What is your current age?")) 3 | # 🚨 Don't change the code above 👆 4 | 5 | #Write your code below this line 👇 6 | 7 | years_remaining = 90 - age 8 | days_remaining = years_remaining * 365 9 | weeks_remaining = years_remaining * 52 10 | months_remaining = years_remaining * 12 11 | 12 | 13 | print(f"You have {days_remaining }, {weeks_remaining} weeks, and {months_remaining} months left") 14 | -------------------------------------------------------------------------------- /Day 2/Tip Calculator/main.py: -------------------------------------------------------------------------------- 1 | #If the bill was $150.00, split between 5 people, with 12% tip. 2 | 3 | #Each person should pay (150.00 / 5) * 1.12 = 33.6 4 | #Format the result to 2 decimal places = 33.60 5 | 6 | #Tip: There are 2 ways to round a number. You might have to do some Googling to solve this.💪 7 | 8 | #Write your code below this line 👇 9 | print("Welcome to the tip calculator!") 10 | 11 | bill = float(input("What was the total bill? :\n")) 12 | tip = int(input("How much tip would you like to give? 10, 12 or 15? :\n")) 13 | tip /= 100 14 | people = int(input("How many people to split the bill? :\n")) 15 | 16 | pay = round((bill / people) + ((bill / people) * tip),2) 17 | 18 | print(f"Each person should pay: ${pay}") 19 | -------------------------------------------------------------------------------- /Day 2/datatypes.py: -------------------------------------------------------------------------------- 1 | mystery = 378_695.24 2 | print(type(mystery)) -------------------------------------------------------------------------------- /Day 2/fstring.py: -------------------------------------------------------------------------------- 1 | score = 0 2 | height = 1.8 3 | isWinning = True 4 | 5 | print(f"Your score is {score}, your height is {height}, you are winning is {isWinning}") -------------------------------------------------------------------------------- /Day 2/mathoperators.py: -------------------------------------------------------------------------------- 1 | score = 0 2 | 3 | score += 1 4 | 5 | print(score) -------------------------------------------------------------------------------- /Day 20-21/Snake Game/food.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | import random 3 | 4 | class Food(Turtle): 5 | def __init__(self): 6 | super().__init__() 7 | self.shape("circle") 8 | self.penup() 9 | self.shapesize(stretch_len = 0.5, stretch_wid = 0.5) 10 | self.color("blue") 11 | self.speed("fastest") 12 | self.summonfood() 13 | 14 | def summonfood(self): 15 | random_x = random.randint(-280, 280) 16 | random_y = random.randint(-270, 270) 17 | self.goto(random_x, random_y) -------------------------------------------------------------------------------- /Day 20-21/Snake Game/main.py: -------------------------------------------------------------------------------- 1 | from turtle import Screen 2 | from snake import Snake 3 | from food import Food 4 | from scoreboard import Scoreboard 5 | import time 6 | 7 | screen = Screen() 8 | screen.setup(width = 600, height = 600) 9 | screen.bgcolor("black") 10 | screen.title("Snake Game") 11 | screen.tracer(0) 12 | 13 | snake = Snake() 14 | food = Food() 15 | scoreboard = Scoreboard() 16 | 17 | screen.listen() 18 | screen.onkey(snake.up, "Up") 19 | screen.onkey(snake.down, "Down") 20 | screen.onkey(snake.left, "Left") 21 | screen.onkey(snake.right, "Right") 22 | 23 | game_on = True 24 | while game_on: 25 | screen.update() 26 | time.sleep(0.1) 27 | snake.move() 28 | 29 | if snake.head.distance(food) < 15: 30 | food.summonfood() 31 | snake.extend() 32 | scoreboard.add_score() 33 | 34 | if snake.head.xcor() > 280 or snake.head.xcor() < -280 or snake.head.ycor() > 280 or snake.head.ycor() < -280: 35 | game_on = False 36 | scoreboard.game_over() 37 | 38 | for x in snake.segments[1:]: 39 | if snake.head.distance(x) < 10: 40 | game_on = False 41 | scoreboard.game_over() 42 | 43 | screen.exitonclick() -------------------------------------------------------------------------------- /Day 20-21/Snake Game/scoreboard.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | 3 | class Scoreboard(Turtle): 4 | def __init__(self): 5 | super().__init__() 6 | self.score = 0 7 | self.penup() 8 | self.color("white") 9 | self.goto(0, 270) 10 | self.hideturtle() 11 | self.update_score() 12 | 13 | def add_score(self): 14 | self.score += 1 15 | self.clear() 16 | self.update_score() 17 | 18 | def update_score(self): 19 | self.write(f"Score: {self.score}", align = "center", font = ("Arial", 20, "normal")) 20 | 21 | def game_over(self): 22 | self.goto(0, 0) 23 | self.write("GAME OVER.", align="center", font=("Arial", 20, "normal")) 24 | -------------------------------------------------------------------------------- /Day 20-21/Snake Game/snake.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | from turtle import Turtle 3 | 4 | starting_x_pos = [(0, 0), (-20, 0), (-40, 0)] 5 | move_dist = 20 6 | up = 90 7 | down = 270 8 | left = 180 9 | right = 0 10 | 11 | class Snake: 12 | def __init__(self): 13 | self.segments = [] 14 | self.create() 15 | self.head = self.segments[0] 16 | 17 | def create(self): 18 | for x in starting_x_pos: 19 | self.add_box(x) 20 | 21 | def add_box(self,position): 22 | new_box = Turtle(shape="square") 23 | new_box.color("white") 24 | new_box.penup() 25 | new_box.goto(position) 26 | self.segments.append(new_box) 27 | 28 | def extend(self): 29 | self.add_box(self.segments[-1].position()) 30 | 31 | def move(self): 32 | for x in range(len(self.segments) - 1, 0, -1): 33 | new_x_pos = self.segments[x - 1].xcor() 34 | new_y_pos = self.segments[x - 1].ycor() 35 | self.segments[x].goto(new_x_pos, new_y_pos) 36 | self.head.forward(move_dist) 37 | 38 | def up(self): 39 | if self.head.heading() != down: 40 | self.head.setheading(90) 41 | 42 | def down(self): 43 | if self.head.heading() != up: 44 | self.head.setheading(down) 45 | 46 | def left(self): 47 | if self.head.heading() != right: 48 | self.head.setheading(left) 49 | 50 | def right(self): 51 | if self.head.heading() != left: 52 | self.head.setheading(right) -------------------------------------------------------------------------------- /Day 20-21/inhert.py: -------------------------------------------------------------------------------- 1 | class Animal: 2 | def __init__(self): 3 | self.num_eyes = 2 4 | 5 | def breathe(self): 6 | print("Inhale, exhale") 7 | 8 | class Fish(Animal): 9 | def __init__(self): 10 | super().__init__() 11 | 12 | def breathe(self): 13 | super().breathe() 14 | print("doing this underwater") 15 | 16 | def swim(self): 17 | print("moving in water") 18 | 19 | nemo = Fish() 20 | nemo.swim() 21 | nemo.breathe() 22 | print(nemo.num_eyes) -------------------------------------------------------------------------------- /Day 22/Pong/ball.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | 3 | class Ball(Turtle): 4 | def __init__(self): 5 | super().__init__() 6 | self.shape("circle") 7 | self.penup() 8 | self.color("white") 9 | self.move_x = 10 10 | self.move_y = 10 11 | self.speed = 0.1 12 | 13 | def move(self): 14 | x_cord = self.xcor() + self.move_x 15 | y_cord = self.ycor() + self.move_y 16 | self.goto(x_cord, y_cord) 17 | 18 | def vertical_bounce(self): 19 | self.move_y *= -1 20 | self.speed *= 0.9 21 | 22 | def horizontal_bounce(self): 23 | self.move_x *= -1 24 | self.speed *= 0.9 25 | 26 | def reset(self): 27 | self.goto(0, 0) 28 | self.speed = 0.1 29 | self.horizontal_bounce() 30 | 31 | -------------------------------------------------------------------------------- /Day 22/Pong/main.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle, Screen 2 | from paddle import Paddle 3 | from ball import Ball 4 | from scoreboard import Scoreboard 5 | import time 6 | 7 | screen = Screen() 8 | screen.setup(width=800, height=600) 9 | screen.bgcolor("black") 10 | screen.title("Pong") 11 | screen.tracer(0) 12 | 13 | right_paddle = Paddle((350, 0)) 14 | left_paddle = Paddle((-350, 0)) 15 | 16 | ball = Ball() 17 | 18 | scoreboard = Scoreboard() 19 | 20 | screen.listen() 21 | screen.onkeypress(right_paddle.go_up, "Up") 22 | screen.onkeypress(right_paddle.go_down, "Down") 23 | screen.onkeypress(left_paddle.go_up, "w") 24 | screen.onkeypress(left_paddle.go_down, "s") 25 | 26 | game_on = True 27 | while game_on: 28 | time.sleep(ball.speed) 29 | screen.update() 30 | ball.move() 31 | 32 | if ball.ycor() > 280 or ball.ycor() < -280: 33 | ball.vertical_bounce() 34 | 35 | if (ball.distance(right_paddle) < 50 and ball.xcor() > 320) or (ball.distance(left_paddle) < 50 and ball.xcor() < -320): 36 | ball.horizontal_bounce() 37 | 38 | if ball.xcor() > 380: 39 | ball.reset() 40 | scoreboard.left_point() 41 | 42 | if ball.xcor() < -380: 43 | ball.reset() 44 | scoreboard.right_point() 45 | 46 | screen.exitonclick() -------------------------------------------------------------------------------- /Day 22/Pong/paddle.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | 3 | class Paddle(Turtle): 4 | def __init__(self, position): 5 | super().__init__() 6 | self.shape("square") 7 | self.color("white") 8 | self.shapesize(stretch_wid=5, stretch_len=1) 9 | self.penup() 10 | self.goto(position) 11 | 12 | def go_up(self): 13 | new_y = self.ycor() + 20 14 | self.goto(self.xcor(), new_y) 15 | 16 | def go_down(self): 17 | new_y = self.ycor() - 20 18 | self.goto(self.xcor(), new_y) -------------------------------------------------------------------------------- /Day 22/Pong/scoreboard.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | 3 | class Scoreboard(Turtle): 4 | def __init__(self): 5 | super().__init__() 6 | self.color("white") 7 | self.penup() 8 | self.hideturtle() 9 | self.left_paddle_score = 0 10 | self.right_paddle_score = 0 11 | self.update() 12 | 13 | def update(self): 14 | self.clear() 15 | self.goto(-100, 230) 16 | self.write(self.left_paddle_score, align="center", font=("Arial", 50, "normal")) 17 | self.goto(100, 230) 18 | self.write(self.right_paddle_score, align="center", font=("Arial", 50, "normal")) 19 | 20 | def left_point(self): 21 | self.left_paddle_score += 1 22 | self.update() 23 | 24 | def right_point(self): 25 | self.right_paddle_score += 1 26 | self.update() -------------------------------------------------------------------------------- /Day 23/Turtle Crossing Game/car_manager.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | import random 3 | 4 | COLORS = ["red", "orange", "yellow", "green", "blue", "purple"] 5 | STARTING_MOVE_DISTANCE = 5 6 | MOVE_INCREMENT = 10 7 | 8 | class CarManager(Turtle): 9 | def __init__(self): 10 | self.all_cars = [] 11 | self.car_speed = STARTING_MOVE_DISTANCE 12 | 13 | def summon_cars(self): 14 | random_summon_chance = random.randint(1,6) 15 | if random_summon_chance == 1: 16 | new_car = Turtle("square") 17 | new_car.shapesize(stretch_wid=1, stretch_len=2) 18 | new_car.penup() 19 | new_car.color(random.choice(COLORS)) 20 | new_car.setheading(180) 21 | new_car.goto(285, random.randint(-240,240)) 22 | self.all_cars.append(new_car) 23 | 24 | def move(self): 25 | for x in self.all_cars: 26 | x.forward(self.car_speed) 27 | 28 | def level_up(self): 29 | self.car_speed += MOVE_INCREMENT -------------------------------------------------------------------------------- /Day 23/Turtle Crossing Game/main.py: -------------------------------------------------------------------------------- 1 | import time 2 | from turtle import Screen 3 | from player import Player 4 | from car_manager import CarManager 5 | from scoreboard import Scoreboard 6 | 7 | screen = Screen() 8 | screen.setup(width=600, height=600) 9 | screen.title("Turtle Crossing Game") 10 | screen.tracer(0) 11 | 12 | turtle = Player() 13 | car = CarManager() 14 | scoreboard = Scoreboard() 15 | 16 | screen.listen() 17 | screen.onkeypress(turtle.move, "Up") 18 | 19 | game_is_on = True 20 | while game_is_on: 21 | time.sleep(0.1) 22 | screen.update() 23 | 24 | car.summon_cars() 25 | car.move() 26 | 27 | for x in car.all_cars: 28 | if x.distance(turtle) < 25: 29 | scoreboard.game_over() 30 | game_is_on = False 31 | 32 | if turtle.ycor() >= 280: 33 | turtle.goto(0, -280) 34 | scoreboard.add_score() 35 | car.level_up() 36 | 37 | screen.exitonclick() -------------------------------------------------------------------------------- /Day 23/Turtle Crossing Game/player.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | 3 | STARTING_POSITION = (0, -280) 4 | MOVE_DISTANCE = 10 5 | FINISH_LINE_Y = 280 6 | 7 | class Player(Turtle): 8 | def __init__(self): 9 | super().__init__() 10 | self.shape("turtle") 11 | self.penup() 12 | self.color("black") 13 | self.setheading(90) 14 | self.goto(STARTING_POSITION) 15 | 16 | def move(self): 17 | self.forward(MOVE_DISTANCE) 18 | 19 | def levelup(self): 20 | self.goto(STARTING_POSITION) 21 | -------------------------------------------------------------------------------- /Day 23/Turtle Crossing Game/scoreboard.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | 3 | FONT = ("Courier", 15, "bold") 4 | 5 | class Scoreboard(Turtle): 6 | def __init__(self): 7 | super().__init__() 8 | self.level = 0 9 | self.penup() 10 | self.color("black") 11 | self.goto(-250, 270) 12 | self.hideturtle() 13 | self.update_level() 14 | 15 | def add_score(self): 16 | self.level += 1 17 | self.clear() 18 | self.update_level() 19 | 20 | def update_level(self): 21 | self.write(f"Level: {self.level}", align ="center", font = FONT) 22 | 23 | def game_over(self): 24 | self.goto(0, 0) 25 | self.write("Game Over.", align="center", font=FONT) 26 | 27 | -------------------------------------------------------------------------------- /Day 24/Mail Merge/Input/Letters/starting_letter.txt: -------------------------------------------------------------------------------- 1 | Dear [name], 2 | 3 | You are invited to my birthday this Wednesday. 4 | 5 | Hope you can make it! 6 | 7 | Burak -------------------------------------------------------------------------------- /Day 24/Mail Merge/Input/Names/invited_names.txt: -------------------------------------------------------------------------------- 1 | Aang 2 | Zuko 3 | Appa 4 | Katara 5 | Sokka 6 | Momo 7 | Uncle Iroh 8 | Toph -------------------------------------------------------------------------------- /Day 24/Mail Merge/Output/ReadyToSend/letter_for_Aang.txt: -------------------------------------------------------------------------------- 1 | Dear Aang, 2 | 3 | You are invited to my birthday this Wednesday. 4 | 5 | Hope you can make it! 6 | 7 | Burak -------------------------------------------------------------------------------- /Day 24/Mail Merge/Output/ReadyToSend/letter_for_Appa.txt: -------------------------------------------------------------------------------- 1 | Dear Appa, 2 | 3 | You are invited to my birthday this Wednesday. 4 | 5 | Hope you can make it! 6 | 7 | Burak -------------------------------------------------------------------------------- /Day 24/Mail Merge/Output/ReadyToSend/letter_for_Katara.txt: -------------------------------------------------------------------------------- 1 | Dear Katara, 2 | 3 | You are invited to my birthday this Wednesday. 4 | 5 | Hope you can make it! 6 | 7 | Burak -------------------------------------------------------------------------------- /Day 24/Mail Merge/Output/ReadyToSend/letter_for_Momo.txt: -------------------------------------------------------------------------------- 1 | Dear Momo, 2 | 3 | You are invited to my birthday this Wednesday. 4 | 5 | Hope you can make it! 6 | 7 | Burak -------------------------------------------------------------------------------- /Day 24/Mail Merge/Output/ReadyToSend/letter_for_Sokka.txt: -------------------------------------------------------------------------------- 1 | Dear Sokka, 2 | 3 | You are invited to my birthday this Wednesday. 4 | 5 | Hope you can make it! 6 | 7 | Burak -------------------------------------------------------------------------------- /Day 24/Mail Merge/Output/ReadyToSend/letter_for_Toph.txt: -------------------------------------------------------------------------------- 1 | Dear Toph, 2 | 3 | You are invited to my birthday this Wednesday. 4 | 5 | Hope you can make it! 6 | 7 | Burak -------------------------------------------------------------------------------- /Day 24/Mail Merge/Output/ReadyToSend/letter_for_Uncle Iroh.txt: -------------------------------------------------------------------------------- 1 | Dear Uncle Iroh, 2 | 3 | You are invited to my birthday this Wednesday. 4 | 5 | Hope you can make it! 6 | 7 | Burak -------------------------------------------------------------------------------- /Day 24/Mail Merge/Output/ReadyToSend/letter_for_Zuko.txt: -------------------------------------------------------------------------------- 1 | Dear Zuko, 2 | 3 | You are invited to my birthday this Wednesday. 4 | 5 | Hope you can make it! 6 | 7 | Burak -------------------------------------------------------------------------------- /Day 24/Mail Merge/main.py: -------------------------------------------------------------------------------- 1 | with open("../Mail Merge/Input/Names/invited_names.txt") as names: 2 | name_list = names.readlines() 3 | 4 | with open("../Mail Merge/Input/Letters/starting_letter.txt") as letter: 5 | letter = letter.read() 6 | for x in name_list: 7 | strip_name = x.strip() 8 | new_letter = letter.replace("[name]", strip_name) 9 | with open(f"./Output/ReadyToSend/letter_for_{strip_name}.txt", "w") as final_letter: 10 | final_letter.write(new_letter) -------------------------------------------------------------------------------- /Day 24/Snake Game/data.txt: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /Day 24/Snake Game/food.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | import random 3 | 4 | 5 | class Food(Turtle): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | self.shape("circle") 10 | self.penup() 11 | self.shapesize(stretch_len=0.5, stretch_wid=0.5) 12 | self.color("blue") 13 | self.speed("fastest") 14 | self.refresh() 15 | 16 | def refresh(self): 17 | random_x = random.randint(-280, 280) 18 | random_y = random.randint(-280, 280) 19 | self.goto(random_x, random_y) 20 | -------------------------------------------------------------------------------- /Day 24/Snake Game/main.py: -------------------------------------------------------------------------------- 1 | from turtle import Screen 2 | from snake import Snake 3 | from food import Food 4 | from scoreboard import Scoreboard 5 | import time 6 | 7 | screen = Screen() 8 | screen.setup(width=600, height=600) 9 | screen.bgcolor("black") 10 | screen.title("My Snake Game") 11 | screen.tracer(0) 12 | 13 | snake = Snake() 14 | food = Food() 15 | scoreboard = Scoreboard() 16 | 17 | screen.listen() 18 | screen.onkey(snake.up, "Up") 19 | screen.onkey(snake.down, "Down") 20 | screen.onkey(snake.left, "Left") 21 | screen.onkey(snake.right, "Right") 22 | 23 | game_is_on = True 24 | while game_is_on: 25 | screen.update() 26 | time.sleep(0.1) 27 | snake.move() 28 | 29 | #Detect collision with food. 30 | if snake.head.distance(food) < 15: 31 | food.refresh() 32 | snake.extend() 33 | scoreboard.increase_score() 34 | 35 | #Detect collision with wall. 36 | if snake.head.xcor() > 280 or snake.head.xcor() < -280 or snake.head.ycor() > 280 or snake.head.ycor() < -280: 37 | scoreboard.reset() 38 | snake.reset() 39 | 40 | #Detect collision with tail. 41 | for segment in snake.segments: 42 | if segment == snake.head: 43 | pass 44 | elif snake.head.distance(segment) < 10: 45 | scoreboard.reset() 46 | snake.reset() 47 | 48 | screen.exitonclick() 49 | -------------------------------------------------------------------------------- /Day 24/Snake Game/scoreboard.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | ALIGNMENT = "center" 3 | FONT = ("Courier", 24, "normal") 4 | 5 | 6 | class Scoreboard(Turtle): 7 | 8 | def __init__(self): 9 | super().__init__() 10 | self.score = 0 11 | with open("data.txt") as file: 12 | self.high_score = int(file.read()) 13 | self.color("white") 14 | self.penup() 15 | self.goto(0, 270) 16 | self.hideturtle() 17 | self.update_scoreboard() 18 | 19 | def update_scoreboard(self): 20 | self.clear() 21 | self.write(f"Score: {self.score} High Score: {self.high_score}", align=ALIGNMENT, font=FONT) 22 | 23 | def reset(self): 24 | if self.score > self.high_score: 25 | self.high_score = self.score 26 | with open("data.txt", "w") as file: 27 | file.write(f"{self.high_score}") 28 | self.score = 0 29 | self.update_scoreboard() 30 | 31 | def increase_score(self): 32 | self.score += 1 33 | self.update_scoreboard() 34 | -------------------------------------------------------------------------------- /Day 24/files.py: -------------------------------------------------------------------------------- 1 | # with open("my_file.txt") as file: 2 | # contents = file.read() 3 | # print(contents) 4 | 5 | with open("new_my_file.txt", mode="w") as file: 6 | file.write("New text.") -------------------------------------------------------------------------------- /Day 24/my_file.txt: -------------------------------------------------------------------------------- 1 | Hello, my name is Burak. 2 | I am 32 years old. 3 | My favourite food is bowl of hot noodles. 4 | New text. -------------------------------------------------------------------------------- /Day 24/new_my_file.txt: -------------------------------------------------------------------------------- 1 | New text. -------------------------------------------------------------------------------- /Day 25/Turkey States Game/states_to_learn.csv: -------------------------------------------------------------------------------- 1 | ,0 2 | 0,Edirne 3 | 1,Kırklareli 4 | 2,Tekirdağ 5 | 3,İstanbul 6 | 4,Kocaeli 7 | 5,Yalova 8 | 6,Bursa 9 | 7,Balıkesir 10 | 8,Çanakkale 11 | 9,Manisa 12 | 10,Aydın 13 | 11,Kütahya 14 | 12,Uşak 15 | 13,Denizli 16 | 14,Burdur 17 | 15,Antalya 18 | 16,Isparta 19 | 17,Afyon 20 | 18,Eskişehir 21 | 19,Bilecik 22 | 20,Sakarya 23 | 21,Düzce 24 | 22,Bolu 25 | 23,Ankara 26 | 24,Konya 27 | 25,Karaman 28 | 26,Mersin 29 | 27,Niğde 30 | 28,Aksaray 31 | 29,Nevşehir 32 | 30,Kırşehir 33 | 31,Kırıkkale 34 | 32,Çankırı 35 | 33,Karabük 36 | 34,Zonguldak 37 | 35,Bartın 38 | 36,Kastamonu 39 | 37,Sinop 40 | 38,Çorum 41 | 39,Yozgat 42 | 40,Kayseri 43 | 41,Adana 44 | 42,Amasya 45 | 43,Samsun 46 | 44,Ordu 47 | 45,Tokat 48 | 46,Sivas 49 | 47,Kahramanmaraş 50 | 48,Osmaniye 51 | 49,Hatay 52 | 50,Kilis 53 | 51,Gaziantep 54 | 52,Adıyaman 55 | 53,Malatya 56 | 54,Giresun 57 | 55,Gümüşhane 58 | 56,Trabzon 59 | 57,Bayburt 60 | 58,Tunceli 61 | 59,Elazığ 62 | 60,Şanlıurfa 63 | 61,Mardin 64 | 62,Batman 65 | 63,Bingöl 66 | 64,Erzurum 67 | 65,Rize 68 | 66,Artvin 69 | 67,Ardahan 70 | 68,Kars 71 | 69,Ağrı 72 | 70,Muş 73 | 71,Bitlis 74 | 72,Siirt 75 | 73,Şırnak 76 | 74,Hakkari 77 | 75,Van 78 | -------------------------------------------------------------------------------- /Day 25/Turkey States Game/turkey_states.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 25/Turkey States Game/turkey_states.gif -------------------------------------------------------------------------------- /Day 25/U.S. 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 -------------------------------------------------------------------------------- /Day 25/U.S. States Game/blank_states_img.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 25/U.S. States Game/blank_states_img.gif -------------------------------------------------------------------------------- /Day 25/U.S. States Game/main.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import pandas as pd 3 | 4 | screen = turtle.Screen() 5 | screen.title("U.S. States Game") 6 | 7 | image = "blank_states_img.gif" 8 | screen.addshape(image) 9 | turtle.shape(image) 10 | guessed = [] 11 | 12 | while len(guessed) < 50: 13 | answer_state = screen.textinput(title=f"{len(guessed)}/50 States Correct", prompt="What's another state's name?").title() 14 | data = pd.read_csv("50_states.csv") 15 | states = data.state.to_list() 16 | 17 | if answer_state == "Exit": 18 | missing = [] 19 | for x in states: 20 | if x not in guessed: 21 | missing.append(x) 22 | new_data = pd.DataFrame(missing) 23 | new_data.to_csv("states_to_learn.csv") 24 | break 25 | 26 | if answer_state in states: 27 | guessed.append(answer_state) 28 | t = turtle.Turtle() 29 | t.hideturtle() 30 | t.penup() 31 | state_data = data[data.state == answer_state] 32 | t.goto(int(state_data.x), int(state_data.y)) 33 | t.write(answer_state) 34 | 35 | 36 | -------------------------------------------------------------------------------- /Day 25/U.S. States Game/states_to_learn.csv: -------------------------------------------------------------------------------- 1 | ,0 2 | 0,Alabama 3 | 1,Alaska 4 | 2,Arizona 5 | 3,Arkansas 6 | 4,California 7 | 5,Colorado 8 | 6,Connecticut 9 | 7,Delaware 10 | 8,Florida 11 | 9,Georgia 12 | 10,Hawaii 13 | 11,Idaho 14 | 12,Illinois 15 | 13,Indiana 16 | 14,Iowa 17 | 15,Kansas 18 | 16,Kentucky 19 | 17,Louisiana 20 | 18,Maine 21 | 19,Maryland 22 | 20,Massachusetts 23 | 21,Michigan 24 | 22,Minnesota 25 | 23,Mississippi 26 | 24,Missouri 27 | 25,Montana 28 | 26,Nebraska 29 | 27,Nevada 30 | 28,New Hampshire 31 | 29,New Jersey 32 | 30,New Mexico 33 | 31,North Carolina 34 | 32,North Dakota 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 | -------------------------------------------------------------------------------- /Day 25/new_data.csv: -------------------------------------------------------------------------------- 1 | ,students,scores 2 | 0,Amy,76 3 | 1,James,56 4 | 2,Angela,65 5 | -------------------------------------------------------------------------------- /Day 25/pand.py: -------------------------------------------------------------------------------- 1 | # import csv 2 | # 3 | # with open("weather_data.csv") as data_file: 4 | # data = csv.reader(data_file) 5 | # temperatures = [] 6 | # for row in data: 7 | # if row[1] != "temp": 8 | # temperatures.append(int(row[1])) 9 | # print(temperatures) 10 | 11 | import pandas as pd 12 | 13 | data = pd.read_csv("weather_data.csv") 14 | # 15 | # temperatures = data["temp"] 16 | # print(temperatures) 17 | 18 | # data_dict = data.to_dict() 19 | # print(data_dict) 20 | # 21 | # temp_list = data["temp"].to_list() 22 | # print(temp_list) 23 | # 24 | # print(data["temp"].mean()) 25 | # print(data["temp"].max()) 26 | # 27 | # #Get Data in Columns 28 | # print(data["condition"]) 29 | # print(data.condition) 30 | 31 | #Get Data in Row 32 | # print(data[data.day == "Monday"]) 33 | # print(data[data.temp == data.temp.max()]) 34 | 35 | monday = data[data.day == "Monday"] 36 | monday_temp = int(monday.temp) 37 | monday_temp_F = monday_temp * 9/5 + 32 38 | print(monday_temp_F) 39 | 40 | #Create a dataframe from scratch 41 | data_dict = { 42 | "students": ["Amy","James", "Angela"], 43 | "scores": [76, 56, 65] 44 | } 45 | dataa = pd.DataFrame(data_dict) 46 | dataa.to_csv("new_data.csv") -------------------------------------------------------------------------------- /Day 25/squirrel.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | data = pd.read_csv("2018_Central_Park_Squirrel_Census_-_Squirrel_Data.csv") 4 | 5 | grey_squirrel_count = len(data[data["Primary Fur Color"] == "Gray"]) 6 | red_squirrel_count = len(data[data["Primary Fur Color"] == "Cinnamon"]) 7 | black_squirrel_count = len(data[data["Primary Fur Color"] == "Black"]) 8 | print(grey_squirrel_count) 9 | print(red_squirrel_count) 10 | print(black_squirrel_count) 11 | 12 | data_dict = { 13 | "Fur Color": ["Gray", "Cinnamon", "Black"], 14 | "Count": [grey_squirrel_count, red_squirrel_count, black_squirrel_count] 15 | } 16 | 17 | df = pd.DataFrame(data_dict) 18 | df.to_csv("squirrel_count.csv") -------------------------------------------------------------------------------- /Day 25/squirrel_count.csv: -------------------------------------------------------------------------------- 1 | ,Fur Color,Count 2 | 0,Gray,2473 3 | 1,Cinnamon,392 4 | 2,Black,103 5 | -------------------------------------------------------------------------------- /Day 25/weather_data.csv: -------------------------------------------------------------------------------- 1 | day,temp,condition 2 | Monday,12,Sunny 3 | Tuesday,14,Rain 4 | Wednesday,15,Rain 5 | Thursday,14,Cloudy 6 | Friday,21,Sunny 7 | Saturday,22,Sunny 8 | Sunday,24,Sunny -------------------------------------------------------------------------------- /Day 26/Exercises/exercise.py: -------------------------------------------------------------------------------- 1 | numbers = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] 2 | # 🚨 Do Not Change the code above 👆 3 | 4 | #Write your 1 line code 👇 below: 5 | squared_numbers = [x ** 2 for x in numbers] 6 | 7 | 8 | #Write your code 👆 above: 9 | 10 | print(squared_numbers) 11 | -------------------------------------------------------------------------------- /Day 26/Exercises/exercise2.py: -------------------------------------------------------------------------------- 1 | numbers = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] 2 | # 🚨 Do Not Change the code above 3 | 4 | #Write your 1 line code 👇 below: 5 | 6 | result = [x for x in numbers if x % 2 == 0] 7 | 8 | #Write your code 👆 above: 9 | 10 | print(result) 11 | -------------------------------------------------------------------------------- /Day 26/Exercises/exercise3.py: -------------------------------------------------------------------------------- 1 | with open("file1.txt") as file1: 2 | file1_numbers = file1.readlines() 3 | with open("file2.txt") as file2: 4 | file2_numbers = file2.readlines() 5 | 6 | file1_numbers = [x.replace("\n", "") for x in file1_numbers] 7 | file2_numbers = [x.replace("\n", "") for x in file2_numbers] 8 | result = [int(x) for x in file1_numbers if x in file2_numbers] 9 | print(result) -------------------------------------------------------------------------------- /Day 26/Exercises/exercise4.py: -------------------------------------------------------------------------------- 1 | sentence = "What is the Airspeed Velocity of an Unladen Swallow?" 2 | # Don't change code above 👆 3 | 4 | # Write your code below: 5 | sentence_words = sentence.split(" ") 6 | sentence_words_dict = {x:len(x) for x in sentence_words} 7 | 8 | print(sentence_words_dict) -------------------------------------------------------------------------------- /Day 26/Exercises/exercise5.py: -------------------------------------------------------------------------------- 1 | weather_c = { 2 | "Monday": 12, 3 | "Tuesday": 14, 4 | "Wednesday": 15, 5 | "Thursday": 14, 6 | "Friday": 21, 7 | "Saturday": 22, 8 | "Sunday": 24, 9 | } 10 | # 🚨 Don't change code above 👆 11 | 12 | 13 | # Write your code 👇 below: 14 | # temp_f = (temp_c * 9/5) + 32 15 | 16 | weather_f = {x:(y * 9/5) + 32 for x,y in weather_c.items()} 17 | 18 | 19 | print(weather_f) 20 | -------------------------------------------------------------------------------- /Day 26/Exercises/file1.txt: -------------------------------------------------------------------------------- 1 | 3 2 | 6 3 | 5 4 | 8 5 | 33 6 | 12 7 | 7 8 | 4 9 | 72 10 | 2 11 | 42 12 | 13 13 | -------------------------------------------------------------------------------- /Day 26/Exercises/file2.txt: -------------------------------------------------------------------------------- 1 | 3 2 | 6 3 | 13 4 | 5 5 | 7 6 | 89 7 | 12 8 | 3 9 | 33 10 | 34 11 | 1 12 | 344 13 | 42 14 | -------------------------------------------------------------------------------- /Day 26/NATO Alphabet/main.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | data = pd.read_csv("nato_phonetic_alphabet.csv") 4 | data_dict = dict(zip(data['letter'], data ['code'])) 5 | 6 | word = input("Enter a word: ").upper() 7 | output_list = [] 8 | 9 | for x in word: 10 | output_list.append(data_dict[x]) 11 | 12 | print(output_list) -------------------------------------------------------------------------------- /Day 26/NATO 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 -------------------------------------------------------------------------------- /Day 26/U.S. 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 -------------------------------------------------------------------------------- /Day 26/U.S. States Game/blank_states_img.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 26/U.S. States Game/blank_states_img.gif -------------------------------------------------------------------------------- /Day 26/U.S. States Game/main.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import pandas as pd 3 | 4 | screen = turtle.Screen() 5 | screen.title("U.S. States Game") 6 | 7 | image = "blank_states_img.gif" 8 | screen.addshape(image) 9 | turtle.shape(image) 10 | guessed = [] 11 | 12 | while len(guessed) < 50: 13 | answer_state = screen.textinput(title=f"{len(guessed)}/50 States Correct", prompt="What's another state's name?").title() 14 | data = pd.read_csv("50_states.csv") 15 | states = data.state.to_list() 16 | 17 | if answer_state == "Exit": 18 | missing = [x for x in states if x not in guessed] 19 | new_data = pd.DataFrame(missing) 20 | new_data.to_csv("states_to_learn.csv") 21 | break 22 | 23 | if answer_state in states: 24 | guessed.append(answer_state) 25 | t = turtle.Turtle() 26 | t.hideturtle() 27 | t.penup() 28 | state_data = data[data.state == answer_state] 29 | t.goto(int(state_data.x), int(state_data.y)) 30 | t.write(answer_state) 31 | 32 | 33 | -------------------------------------------------------------------------------- /Day 26/U.S. States Game/states_to_learn.csv: -------------------------------------------------------------------------------- 1 | ,0 2 | 0,Alabama 3 | 1,Alaska 4 | 2,Arizona 5 | 3,Arkansas 6 | 4,California 7 | 5,Colorado 8 | 6,Connecticut 9 | 7,Delaware 10 | 8,Florida 11 | 9,Georgia 12 | 10,Hawaii 13 | 11,Idaho 14 | 12,Illinois 15 | 13,Indiana 16 | 14,Iowa 17 | 15,Kansas 18 | 16,Kentucky 19 | 17,Louisiana 20 | 18,Maine 21 | 19,Maryland 22 | 20,Massachusetts 23 | 21,Michigan 24 | 22,Minnesota 25 | 23,Mississippi 26 | 24,Missouri 27 | 25,Montana 28 | 26,Nebraska 29 | 27,Nevada 30 | 28,New Hampshire 31 | 29,New Jersey 32 | 30,New Mexico 33 | 31,North Carolina 34 | 32,North Dakota 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 | -------------------------------------------------------------------------------- /Day 26/comp.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | # number = [1, 2, 3] 4 | # new_numbers = [x + 1 for x in number] 5 | # print(new_numbers) 6 | 7 | # name = "Burak" 8 | # new_name = [x for x in name] 9 | # print(new_name) 10 | 11 | # number_list = [x * 2 for x in range(1, 5)] 12 | # print(number_list) 13 | 14 | names = ["Alex", "Beth", "Caroline", "Dave", "Elanor", "Freddie"] 15 | # short_names = [x for x in names if len(x) < 5] 16 | # print(short_names) 17 | 18 | students_scores = {x:random.randint(0, 100) for x in names} 19 | passed_students = {x:y for (x,y) in students_scores.items() if y > 75} 20 | print(students_scores) 21 | print(passed_students) -------------------------------------------------------------------------------- /Day 26/itera.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | student_dict = { 4 | "student": ["Angela", "James", "Lily"], 5 | "score": [56, 76, 98] 6 | } 7 | 8 | studen_data_frame = pd.DataFrame(student_dict) 9 | # print(studen_data_frame) 10 | 11 | #Loop thorugh data frame 12 | 13 | # for (key,value) in studen_data_frame.items(): 14 | # print(value) 15 | 16 | # Loop through rows a data frame 17 | 18 | for(index, row) in studen_data_frame.iterrows(): 19 | if row.student == "Angela": 20 | print(row.score) -------------------------------------------------------------------------------- /Day 27/Mile To Kilometers Converter/main.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | 3 | window = Tk() 4 | window.title("Mile to Km Converter") 5 | window.config(padx=50, pady=50) 6 | 7 | miles_text = Entry(width=10) 8 | miles_text.grid(column=2, row=1) 9 | 10 | miles_label = Label(text="Miles", font=("Arial", 12)) 11 | miles_label.grid(column=3, row=1) 12 | 13 | equal_text = Label(text="is equal to", font=("Arial", 12)) 14 | equal_text.grid(column=1, row=2) 15 | 16 | km_text = Label(text="", font=("Arial", 14)) 17 | km_text.grid(column=2, row=2) 18 | 19 | km_label = Label(text="Km", font=("Arial", 12)) 20 | km_label.grid(column=3, row=2) 21 | 22 | def button_clicked(): 23 | km_text["text"] = str(round(int(miles_text.get()) * 1.609)) 24 | 25 | button = Button(text="Calculate", command=button_clicked) 26 | button.grid(column=2, row=3) 27 | 28 | window.mainloop() -------------------------------------------------------------------------------- /Day 27/button_entry_comp.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | 3 | window = Tk() 4 | window.title("My First GUI Program") 5 | window.minsize(width=500, height=300) 6 | 7 | #Label 8 | my_label = Label(text="I Am a Label", font=("Arial", 24, "bold")) 9 | my_label.pack() 10 | 11 | my_label["text"] = "New Text" 12 | my_label.config(text="New Text") #same 13 | 14 | def button_clicked(): 15 | my_label["text"] = input.get() 16 | 17 | button = Button(text="Click Me", command=button_clicked) 18 | button.pack() 19 | 20 | #Entry 21 | input = Entry(width=10) 22 | input.pack() 23 | print(input.get()) 24 | 25 | window.mainloop() -------------------------------------------------------------------------------- /Day 27/kwar.py: -------------------------------------------------------------------------------- 1 | def calculate(n, **kwargs): 2 | print(kwargs) 3 | # for key, value in kwargs.items(): 4 | # print(kwargs["add"]) 5 | n += kwargs["add"] 6 | n *= kwargs["multiply"] 7 | print(n) 8 | 9 | calculate(2, add=3, multiply=5) 10 | 11 | class Car: 12 | def __init__(self, **kw): 13 | self.make = kw.get("make") 14 | self.model = kw.get("model") 15 | self.colour = kw.get("colour") 16 | self.seats = kw.get("seats") 17 | 18 | my_car = Car(make="Nissan", model="Skyline") 19 | print(my_car.model) -------------------------------------------------------------------------------- /Day 27/layout.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | 3 | window = Tk() 4 | window.title("My First GUI Program") 5 | window.minsize(width=500, height=300) 6 | window.config(padx=20, pady=20) 7 | 8 | #Label 9 | my_label = Label(text="I Am a Label", font=("Arial", 24, "bold")) 10 | my_label.grid(column=0, row=0) 11 | my_label.config(padx=50, pady=50) 12 | 13 | my_label["text"] = "New Text" 14 | my_label.config(text="New Text") #same 15 | 16 | def button_clicked(): 17 | my_label["text"] = input.get() 18 | 19 | button = Button(text="Click Me", command=button_clicked) 20 | button.grid(column=2, row=2) 21 | 22 | button2 = Button(text="Click Me2", command=button_clicked) 23 | button2.grid(column=3, row=1) 24 | 25 | #Entry 26 | input = Entry(width=10) 27 | input.grid(column=4, row=4) 28 | 29 | 30 | window.mainloop() -------------------------------------------------------------------------------- /Day 27/win_label.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | 3 | window = tkinter.Tk() 4 | window.title("My First GUI Program") 5 | window.minsize(width=500, height=300) 6 | 7 | #Label 8 | my_label = tkinter.Label(text="I Am a Label", font=("Arial", 24, "bold")) 9 | my_label.pack(side="left") 10 | 11 | 12 | window.mainloop() -------------------------------------------------------------------------------- /Day 28/Pomodoro Timer/tomato.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 28/Pomodoro Timer/tomato.png -------------------------------------------------------------------------------- /Day 29/Password Generator/data.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Day 29/Password Generator/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 29/Password Generator/logo.png -------------------------------------------------------------------------------- /Day 3/Exercise/exercise1.py: -------------------------------------------------------------------------------- 1 | # 🚨 Don't change the code below 👇 2 | number = int(input("Which number do you want to check? ")) 3 | # 🚨 Don't change the code above 👆 4 | 5 | #Write your code below this line 👇 6 | 7 | if number % 2 == 0: 8 | print("This is an even number.") 9 | else: 10 | print("This is a odd number.") -------------------------------------------------------------------------------- /Day 3/Exercise/exercise2.py: -------------------------------------------------------------------------------- 1 | # 🚨 Don't change the code below 👇 2 | height = float(input("enter your height in m: ")) 3 | weight = float(input("enter your weight in kg: ")) 4 | # 🚨 Don't change the code above 👆 5 | 6 | #Write your code below this line 👇 7 | bmi = round(weight / (height * height)) 8 | 9 | if bmi < 18.5: 10 | print(f"Your BMI is {bmi}, you are underweight.") 11 | elif bmi > 18.5 and bmi < 25: 12 | print(f"Your BMI is {bmi}, you have a normal weight.") 13 | elif bmi > 25 and bmi < 30: 14 | print(f"Your BMI is {bmi}, you are slightly overweight.") 15 | elif bmi > 30 and bmi < 35: 16 | print(f"Your BMI is {bmi}, you are obese.") 17 | else: 18 | print(f"Your BMI is {bmi}, you are clinically obese.") -------------------------------------------------------------------------------- /Day 3/Exercise/exercise3.py: -------------------------------------------------------------------------------- 1 | # 🚨 Don't change the code below 👇 2 | year = int(input("Which year do you want to check? ")) 3 | # 🚨 Don't change the code above 👆 4 | 5 | #Write your code below this line 👇 6 | 7 | if year % 4 == 0: 8 | if year % 100 != 0: 9 | print("Leap year.") 10 | else: 11 | if year % 400 != 0: 12 | print("Not leap year.") 13 | else: 14 | print("Leap year.") 15 | else: 16 | print("Not leap year") -------------------------------------------------------------------------------- /Day 3/Exercise/exercise4.py: -------------------------------------------------------------------------------- 1 | # 🚨 Don't change the code below 👇 2 | print("Welcome to Python Pizza Deliveries!") 3 | size = input("What size pizza do you want? S, M, or L ") 4 | add_pepperoni = input("Do you want pepperoni? Y or N ") 5 | extra_cheese = input("Do you want extra cheese? Y or N ") 6 | # 🚨 Don't change the code above 👆 7 | 8 | #Write your code below this line 👇 9 | 10 | small_pizza = 15 11 | medium_pizza = 20 12 | large_pizza = 25 13 | addpepperoni_small = 2 14 | addpepperoni_medium = 3 15 | addextracheese = 1 16 | bill = 0 17 | 18 | if size == "S": 19 | bill += 15 20 | if add_pepperoni == "Y": 21 | bill += 2 22 | if extra_cheese == "Y": 23 | bill += 1 24 | elif size == "M": 25 | bill += 20 26 | if add_pepperoni == "Y": 27 | bill += 3 28 | if extra_cheese == "Y": 29 | bill += 1 30 | else: 31 | bill += 25 32 | if add_pepperoni == "Y": 33 | bill += 3 34 | if extra_cheese == "Y": 35 | bill += 1 36 | 37 | print(f"Your final bill is: ${bill}.") 38 | 39 | -------------------------------------------------------------------------------- /Day 3/Exercise/exercise5.py: -------------------------------------------------------------------------------- 1 | # 🚨 Don't change the code below 👇 2 | print("Welcome to the Love Calculator!") 3 | name1 = input("What is your name? \n") 4 | name2 = input("What is their name? \n") 5 | # 🚨 Don't change the code above 👆 6 | 7 | #Write your code below this line 👇 8 | name1 = name1.lower() 9 | name2 = name2.lower() 10 | 11 | T = name1.count("t") + name2.count("t") 12 | R = name1.count("r") + name2.count("r") 13 | U = name1.count("u") + name2.count("u") 14 | E = name1.count("e") + name2.count("e") 15 | score1 = str(T + R + U + E) 16 | 17 | L = name1.count("l") + name2.count("l") 18 | O = name1.count("o") + name2.count("o") 19 | V = name1.count("v") + name2.count("v") 20 | E = name1.count("e") + name2.count("e") 21 | score2 = str(L + O + V + E) 22 | 23 | love_score = int(score1 + score2) 24 | 25 | if love_score < 10 or love_score > 90: 26 | print(f"Your score is {love_score}, you go together like coke and mentos.") 27 | elif love_score > 40 and love_score < 50: 28 | print(f"Your score is {love_score}, you are alright together.") 29 | else: 30 | print(f"Your score is {love_score}.") -------------------------------------------------------------------------------- /Day 3/if_else.py: -------------------------------------------------------------------------------- 1 | print("Welcome to the rollercoaster!") 2 | 3 | height = int(input("Wha is your height in cm?")) 4 | bill = 0 5 | 6 | if height >= 120: 7 | print("You can ride rollercoaster!") 8 | age = int(input("What is you age?")) 9 | if age < 12: 10 | bill = 5 11 | print("Child tickets are $5.") 12 | elif age <= 18: 13 | bill = 7 14 | print("Youth tickets are $7.") 15 | elif age >= 45 and age <= 55: 16 | print("Everything is going to be ok. Have a free ride on us!") 17 | else: 18 | bill = 12 19 | print("Adult tickets are $12.") 20 | wants_photo = input("Do you want a photo taken? Y or N.") 21 | if wants_photo == "Y": 22 | bill += 3 23 | print(f"Your final bill is ${bill}") 24 | else: 25 | print("Sorry, you have to grow taller before you can ride.") -------------------------------------------------------------------------------- /Day 30/Exercises/exercise.py: -------------------------------------------------------------------------------- 1 | fruits = ["Apple", "Pear", "Orange"] 2 | 3 | #TODO: Catch the exception and make sure the code runs without crashing. 4 | def make_pie(index): 5 | fruit = fruits[index] 6 | print(fruit + " pie") 7 | 8 | 9 | answer = int(input("Index ?: ")) 10 | try: 11 | make_pie(answer) 12 | except: 13 | print("Fruit pie") -------------------------------------------------------------------------------- /Day 30/Exercises/exercise2.py: -------------------------------------------------------------------------------- 1 | facebook_posts = [ 2 | {'Likes': 21, 'Comments': 2}, 3 | {'Likes': 13, 'Comments': 2, 'Shares': 1}, 4 | {'Likes': 33, 'Comments': 8, 'Shares': 3}, 5 | {'Comments': 4, 'Shares': 2}, 6 | {'Comments': 1, 'Shares': 1}, 7 | {'Likes': 19, 'Comments': 3} 8 | ] 9 | 10 | total_likes = 0 11 | 12 | for post in facebook_posts: 13 | try: 14 | total_likes = total_likes + post['Likes'] 15 | except KeyError: 16 | pass 17 | 18 | 19 | print(total_likes) -------------------------------------------------------------------------------- /Day 30/NATO Alphabet/main.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | data = pd.read_csv("nato_phonetic_alphabet.csv") 4 | data_dict = dict(zip(data['letter'], data ['code'])) 5 | 6 | def generate_phonetic(): 7 | word = input("Enter a word: ").upper() 8 | try: 9 | output_list = [data_dict[letter] for letter in word] 10 | except: 11 | print("Sorry, only letters in the alphabet please.") 12 | generate_phonetic() 13 | else: 14 | print(output_list) 15 | 16 | generate_phonetic() -------------------------------------------------------------------------------- /Day 30/NATO 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 -------------------------------------------------------------------------------- /Day 30/Password Generator/data.txt: -------------------------------------------------------------------------------- 1 | Twitter | burakcode | *%QpBNjg6k3L1& 2 | Instagram | burak@gmail.com | IY6%S0W6Bd#5*AZn 3 | Facebook | burak@gmail.com | 2QX)VAO7zbl(Y61V 4 | -------------------------------------------------------------------------------- /Day 30/Password Generator/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 30/Password Generator/logo.png -------------------------------------------------------------------------------- /Day 30/a_file.txt: -------------------------------------------------------------------------------- 1 | Something -------------------------------------------------------------------------------- /Day 30/exceptions.py: -------------------------------------------------------------------------------- 1 | # try: 2 | # file = open("a_file.txt") 3 | # a_dictionary = {"key":"value"} 4 | # print(a_dictionary["key"]) 5 | # except FileNotFoundError: 6 | # file = open("a_file.txt", "w") 7 | # file.write("Something") 8 | # except KeyError as error_message: 9 | # print(f"The key {error_message} does not exist.") 10 | # else: 11 | # content = file.read() 12 | # print(content) 13 | # finally: 14 | # raise TypeError("This is an error that I made up.") 15 | 16 | height = float(input("Height: ")) 17 | weight =int(input("Weight: ")) 18 | 19 | if height > 3: 20 | raise ValueError("Cannot be") 21 | 22 | bmi = weight / height ** 2 23 | print(bmi) -------------------------------------------------------------------------------- /Day 31/Flash Cards/images/card_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 31/Flash Cards/images/card_back.png -------------------------------------------------------------------------------- /Day 31/Flash Cards/images/card_front.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 31/Flash Cards/images/card_front.png -------------------------------------------------------------------------------- /Day 31/Flash Cards/images/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 31/Flash Cards/images/right.png -------------------------------------------------------------------------------- /Day 31/Flash Cards/images/wrong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 31/Flash Cards/images/wrong.png -------------------------------------------------------------------------------- /Day 32/Automated Birthday Wisher/birthdays.csv: -------------------------------------------------------------------------------- 1 | name,email,year,month,day 2 | Me,burakkcode@gmail.com,1990,01,03 3 | Wife,nihal112233@icloud.com,1995,10,22 -------------------------------------------------------------------------------- /Day 32/Automated Birthday Wisher/letter_templates/letter_1.txt: -------------------------------------------------------------------------------- 1 | Dear [NAME], 2 | 3 | Happy birthday! 4 | 5 | All the best for the year! 6 | 7 | Angela -------------------------------------------------------------------------------- /Day 32/Automated Birthday Wisher/letter_templates/letter_2.txt: -------------------------------------------------------------------------------- 1 | Hey [NAME], 2 | 3 | Happy birthday! Have a wonderful time today and eat lots of cake! 4 | 5 | Lots of love, 6 | 7 | Angela -------------------------------------------------------------------------------- /Day 32/Automated Birthday Wisher/letter_templates/letter_3.txt: -------------------------------------------------------------------------------- 1 | Dear [NAME], 2 | 3 | It's your birthday! Have a great day! 4 | 5 | All my love, 6 | 7 | Angela -------------------------------------------------------------------------------- /Day 32/Automated Birthday Wisher/main.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | import pandas as pd 3 | import random 4 | import smtplib 5 | 6 | today = datetime.now() 7 | month_and_day = (today.month, today.day) 8 | 9 | data = pd.read_csv("birthdays.csv") 10 | birthdays_dict = {(data_row["month"], data_row["day"]): data_row for (index, data_row) in data.iterrows()} 11 | 12 | if month_and_day in birthdays_dict: 13 | birthday_person = birthdays_dict[month_and_day] 14 | letter = f"letter_templates/letter_{random.randint(1, 3)}" 15 | with open(letter) as file: 16 | contents = file.read() 17 | contents.replace("[NAME]", birthday_person["name"]) 18 | 19 | my_email = "burakkcode@gmail.com" 20 | password = "123456" 21 | 22 | with smtplib.SMTP("smtp.gmail.com", 587) as connection: 23 | connection.starttls() 24 | connection.login(user=my_email, password=password) 25 | connection.sendmail(from_addr=my_email, to_addrs=birthday_person["email"], 26 | msg=f"Subject:Happy Birthday!\n\n{contents}") 27 | -------------------------------------------------------------------------------- /Day 32/Email - Motivational Quotes/main.py: -------------------------------------------------------------------------------- 1 | import smtplib 2 | import datetime as dt 3 | import random 4 | 5 | now = dt.datetime.now() 6 | day_of_week = now.weekday() 7 | if day_of_week == 3: 8 | with open("quotes.txt") as file: 9 | quotes_list = file.readlines() 10 | random_quotes = random.choice(quotes_list) 11 | 12 | my_email = "burakkcode@gmail.com" 13 | password = "123456" 14 | 15 | with smtplib.SMTP("smtp.gmail.com", 587) as connection: 16 | connection.starttls() 17 | connection.login(user=my_email, password=password) 18 | connection.sendmail(from_addr=my_email, to_addrs="mail@gmail.com", 19 | msg=f"Subject:Quote\n\n{random_quotes}") 20 | 21 | 22 | -------------------------------------------------------------------------------- /Day 32/dateti.py: -------------------------------------------------------------------------------- 1 | import datetime as dt 2 | 3 | now = dt.datetime.now() 4 | year = now.year 5 | month = now.month 6 | day_of_week = now.weekday() 7 | print(day_of_week) 8 | 9 | date_of_birth = dt.datetime(year=1990, month=12, day=15) 10 | print(date_of_birth) -------------------------------------------------------------------------------- /Day 33/ISS Overhead Notifier/main.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from datetime import datetime 3 | import smtplib 4 | 5 | MY_EMAIL = "burakkcode@gmail.com" 6 | MY_PASS = "12345" 7 | MY_LAT = 40.774021 8 | MY_LNG = 29.918631 9 | 10 | def is_iss_overhead(): 11 | response = requests.get(url="http://api.open-notify.org/iss-now.json") 12 | data = response.json() 13 | iss_longitude = float(data["iss_position"]["longitude"]) 14 | iss_latitude = float(data["iss_position"]["latitude"]) 15 | 16 | if MY_LAT - 5 <= iss_latitude <= MY_LAT + 5 and MY_LNG - 5 <= iss_longitude <= MY_LNG + 5: 17 | return True 18 | 19 | def is_night(): 20 | parameters = { 21 | "lat": MY_LAT, 22 | "lng": MY_LNG, 23 | "formatted": 0 24 | } 25 | response = requests.get(url="https://api.sunrise-sunset.org/json", params=parameters) 26 | data = response.json() 27 | sunrise = int(data["results"]["sunrise"].split("T")[1].split(":")[0]) 28 | sunset = int(data["results"]["sunset"].split("T")[1].split(":")[0]) 29 | time_now = datetime.now().hour 30 | 31 | if time_now >= sunset or time_now <= sunrise: 32 | return True 33 | 34 | if is_iss_overhead() and is_night(): 35 | connection = smtplib.SMTP("smtp.gmail.com", 587) 36 | connection.starttls() 37 | connection.login(MY_EMAIL, MY_PASS) 38 | connection.sendmail(from_addr=MY_EMAIL, to_addrs="mail.gmail.com", msg="Subject:Look Up!\n\nThe ISS is above you in the sky.") 39 | -------------------------------------------------------------------------------- /Day 33/Kanye Rest API/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 33/Kanye Rest API/background.png -------------------------------------------------------------------------------- /Day 33/Kanye Rest API/kanye.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 33/Kanye Rest API/kanye.png -------------------------------------------------------------------------------- /Day 33/Kanye Rest API/main.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | import requests 3 | 4 | def get_quote(): 5 | response = requests.get(url="https://api.kanye.rest/") 6 | data = response.json() 7 | canvas.itemconfig(quote_text, text=data["quote"]) 8 | 9 | window = Tk() 10 | window.title("Kanye Says...") 11 | window.config(padx=50, pady=50) 12 | 13 | canvas = Canvas(width=300, height=414) 14 | background_img = PhotoImage(file="background.png") 15 | canvas.create_image(150, 207, image=background_img) 16 | quote_text = canvas.create_text(150, 207, text="Kanye Quote Goes HERE", width=250, font=("Arial", 30, "bold"), fill="white") 17 | canvas.grid(row=0, column=0) 18 | 19 | kanye_img = PhotoImage(file="kanye.png") 20 | kanye_button = Button(image=kanye_img, highlightthickness=0, command=get_quote) 21 | kanye_button.grid(row=1, column=0) 22 | 23 | window.mainloop() -------------------------------------------------------------------------------- /Day 33/api_parameters.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from datetime import datetime 3 | 4 | MY_LAT = 40.774021 5 | MY_LNG = 29.918631 6 | parameters = { 7 | "lat": MY_LAT, 8 | "lng": MY_LNG, 9 | "formatted": 0 10 | } 11 | response = requests.get(url="https://api.sunrise-sunset.org/json", params=parameters) 12 | data = response.json() 13 | sunrise = int(data["results"]["sunrise"].split("T")[1].split(":")[0]) 14 | sunset = int(data["results"]["sunset"].split("T")[1].split(":")[0]) 15 | 16 | print(sunrise) 17 | print(sunset) 18 | 19 | time_now = datetime.now() 20 | print(time_now.hour) 21 | 22 | -------------------------------------------------------------------------------- /Day 33/responses.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | response = requests.get(url="http://api.open-notify.org/iss-now.json") 4 | data = response.json() 5 | longitude = data["iss_position"]["longitude"] 6 | latitude = data["iss_position"]["latitude"] 7 | 8 | iss_position = (longitude, latitude) 9 | print(iss_position) -------------------------------------------------------------------------------- /Day 34/Quizzler/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 | data = response.json() 10 | question_data = data["results"] 11 | -------------------------------------------------------------------------------- /Day 34/Quizzler/images/false.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 34/Quizzler/images/false.png -------------------------------------------------------------------------------- /Day 34/Quizzler/images/true.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 34/Quizzler/images/true.png -------------------------------------------------------------------------------- /Day 34/Quizzler/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 | quiz = QuizBrain(question_bank) 14 | quiz_ui = QuizInterface(quiz) -------------------------------------------------------------------------------- /Day 34/Quizzler/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 | -------------------------------------------------------------------------------- /Day 34/Quizzler/quiz_brain.py: -------------------------------------------------------------------------------- 1 | import html 2 | 3 | class QuizBrain: 4 | 5 | def __init__(self, q_list): 6 | self.question_number = 0 7 | self.score = 0 8 | self.question_list = q_list 9 | self.current_question = None 10 | 11 | def still_has_questions(self): 12 | return self.question_number < len(self.question_list) 13 | 14 | def next_question(self): 15 | self.current_question = self.question_list[self.question_number] 16 | self.question_number += 1 17 | q_text = html.unescape(self.current_question.text) 18 | return f"Q.{self.question_number}: {q_text}" 19 | 20 | def check_answer(self, user_answer): 21 | correct_answer = self.current_question.answer 22 | if user_answer.lower() == correct_answer.lower(): 23 | self.score += 1 24 | return True 25 | else: 26 | return False 27 | -------------------------------------------------------------------------------- /Day 35/Send SMS - Weather/main.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from twilio.rest import Client 3 | 4 | OWM_Endpoint = "https://api.openweathermap.org/data/2.5/onecall" 5 | api_key = "0" 6 | account_sid = "0" 7 | auth_token = "0" 8 | client = Client(account_sid, auth_token) 9 | 10 | parameters = { 11 | "lat": 40.762402, 12 | "lon": 29.932949, 13 | "exclude": "current,minutely,daily", 14 | "appid": api_key 15 | } 16 | 17 | response = requests.get(OWM_Endpoint, params=parameters) 18 | data = response.json() 19 | data_weather_id = data["hourly"][0]["weather"][0]["id"] 20 | 21 | will_rain = False 22 | 23 | for x in range(0,13): 24 | weather_condition = data["hourly"][x]["weather"][0]["id"] 25 | if weather_condition < 700: 26 | will_rain = True 27 | 28 | if will_rain: 29 | message = client.messages \ 30 | .create( 31 | body="Bugün yağmur var, şemsiyeni al!", 32 | from_='+000000000', 33 | to='+000000000' 34 | ) 35 | print(message.sid) -------------------------------------------------------------------------------- /Day 4/Exercise/exercise1.py: -------------------------------------------------------------------------------- 1 | #Write your code below this line 👇 2 | #Hint: Remember to import the random module first. 🎲 3 | import random 4 | 5 | heads_or_tails = random.randint(0,1) 6 | 7 | if heads_or_tails == 1: 8 | print("Heads") 9 | else: 10 | print("Tails") 11 | -------------------------------------------------------------------------------- /Day 4/Exercise/exercise2.py: -------------------------------------------------------------------------------- 1 | import random 2 | # Split string method 3 | names_string = input("Give me everybody's names, separated by a comma. ") 4 | names = names_string.split(", ") 5 | # 🚨 Don't change the code above 👆 6 | 7 | #Write your code below this line 👇 8 | 9 | choice = random.randint(0,len(names) - 1) 10 | 11 | print(f"{names[choice]} is going to buy the meal today!") -------------------------------------------------------------------------------- /Day 4/Exercise/exercise3.py: -------------------------------------------------------------------------------- 1 | # 🚨 Don't change the code below 👇 2 | row1 = ["⬜️","⬜️","⬜️"] 3 | row2 = ["⬜️","⬜️","⬜️"] 4 | row3 = ["⬜️","⬜️","⬜️"] 5 | map = [row1, row2, row3] 6 | print(f"{row1}\n{row2}\n{row3}") 7 | position = int(input("Where do you want to put the treasure? Sample: 31, means 3.column 1.row : \n")) 8 | # 🚨 Don't change the code above 👆 9 | 10 | #Write your code below this row 👇 11 | 12 | column = position // 10 13 | row = position % 10 14 | 15 | map[row-1][column-1] = "X" 16 | 17 | #Write your code above this row 👆 18 | 19 | # 🚨 Don't change the code below 👇 20 | print(f"{row1}\n{row2}\n{row3}") -------------------------------------------------------------------------------- /Day 4/Rock Paper Scissors/main.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | rock = ''' 4 | _______ 5 | ---' ____) 6 | (_____) 7 | (_____) 8 | (____) 9 | ---.__(___) 10 | ''' 11 | 12 | paper = ''' 13 | _______ 14 | ---' ____)____ 15 | ______) 16 | _______) 17 | _______) 18 | ---.__________) 19 | ''' 20 | 21 | scissors = ''' 22 | _______ 23 | ---' ____)____ 24 | ______) 25 | __________) 26 | (____) 27 | ---.__(___) 28 | ''' 29 | 30 | game_images = [rock, paper, scissors] 31 | 32 | user_choice = int(input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors.\n")) 33 | computer_choice = random.randint(0, 2) 34 | 35 | print(game_images[user_choice]) 36 | print("Computer chose:") 37 | print(game_images[computer_choice]) 38 | 39 | if user_choice >= 3 or user_choice < 0: 40 | print("You typed an invalid number, you lose!") 41 | elif user_choice == 0 and computer_choice == 2: 42 | print("You Win!") 43 | elif computer_choice == 0 and user_choice == 2: 44 | print("You Lose") 45 | elif computer_choice > user_choice: 46 | print("You Lose") 47 | elif user_choice > computer_choice: 48 | print("You Win!") 49 | elif computer_choice == user_choice: 50 | print("It's a draw") -------------------------------------------------------------------------------- /Day 4/list_lesson.py: -------------------------------------------------------------------------------- 1 | states_of_america = ["Delaware", "Pennsylvania", "New Jersey", "Georgia", "Connecticut", "Massachusetts", "Maryland", 2 | "South Carolina", "New Hampshire", "Virginia", "New York", "North Carolina", "Rhode Island", 3 | "Vermont", "Kentucky", "Tennessee", "Ohio", "Louisiana", "Indiana", "Mississippi", "Illinois", 4 | "Alabama", "Maine", "Missouri", "Arkansas", "Michigan", "Florida", "Texas", "Iowa", "Wisconsin", 5 | "California", "Minnesota", "Oregon", "Kansas", "West Virginia", "Nevada", "Nebraska", "Colorado", 6 | "North Dakota", "South Dakota", "Montana", "Washington", "Idaho", "Wyoming", "Utah", "Oklahoma", 7 | "New Mexico", "Arizona", "Alaska", "Hawaii"] 8 | 9 | 10 | fruits = ["Strawberries", "Nectarines", "Apples", "Grapes", "Peaches", "Cherries", "Pears",] 11 | vegetables = ["Spinach","Kale", "Tomatoes", "Celery", "Potatoes"] 12 | 13 | dirty_dozen = [fruits,vegetables] 14 | 15 | print(dirty_dozen) 16 | -------------------------------------------------------------------------------- /Day 4/random_lesson.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | random_integer = random.randint(1,10) 4 | 5 | print(random_integer) 6 | 7 | random_float = random.random() * 5 8 | 9 | print(random_float) 10 | 11 | love_score = random.randint(1,100) 12 | 13 | print(f"Your love score is {love_score}") 14 | -------------------------------------------------------------------------------- /Day 41-44/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 41-44/favicon/favicon.ico -------------------------------------------------------------------------------- /Day 41-44/images/burak.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 41-44/images/burak.png -------------------------------------------------------------------------------- /Day 41-44/images/chillies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 41-44/images/chillies.png -------------------------------------------------------------------------------- /Day 41-44/images/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 41-44/images/cloud.png -------------------------------------------------------------------------------- /Day 41-44/images/computer-modified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 41-44/images/computer-modified.png -------------------------------------------------------------------------------- /Day 41-44/images/computer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 41-44/images/computer.png -------------------------------------------------------------------------------- /Day 41-44/images/mountain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 41-44/images/mountain.png -------------------------------------------------------------------------------- /Day 41-44/images/screen-2-modified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 41-44/images/screen-2-modified.png -------------------------------------------------------------------------------- /Day 45/The 100 Greatest Movies/main.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from bs4 import BeautifulSoup 3 | 4 | URL = "https://web.archive.org/web/20200518073855/https://www.empireonline.com/movies/features/best-movies-2/" 5 | 6 | response = requests.get(URL) 7 | website = response.text 8 | 9 | soup = BeautifulSoup(website, "html.parser") 10 | 11 | movies = soup.find_all(name="h3", class_="title") 12 | 13 | titles = [movie.getText() for movie in movies] 14 | movies = titles[::-1] 15 | 16 | with open("movies.txt", "w") as file: 17 | for movie in movies: 18 | file.write(f"{movie}\n") -------------------------------------------------------------------------------- /Day 45/The 100 Greatest Movies/movies.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/burakkcoder/100DaysOfCode_Python/f967747cef910ce3ba4c90c94c03aa4f3bc726d7/Day 45/The 100 Greatest Movies/movies.txt -------------------------------------------------------------------------------- /Day 45/beasoup.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | # import lxml 3 | 4 | with open("website.html", encoding="utf-8") as file: 5 | contents = file.read() 6 | 7 | soup = BeautifulSoup(contents, "html.parser") 8 | 9 | # print(soup.title.string) 10 | # print(soup.prettify()) 11 | # print(soup.a) 12 | 13 | all_anchor_tags = soup.find_all(name="a") 14 | 15 | # for x in all_anchor_tags: 16 | # print(x.getText()) 17 | 18 | # for x in all_anchor_tags: 19 | # print(x.get("href")) 20 | 21 | # heading = soup.find(name="h1", id="name") 22 | # print(heading) 23 | 24 | # section_heading = soup.find(name="h3", class_="heading") 25 | # print(section_heading.get("class")) 26 | 27 | name = soup.select_one(selector="#name") 28 | print(name) -------------------------------------------------------------------------------- /Day 45/liveweb.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | import requests 3 | 4 | response = requests.get("https://news.ycombinator.com/news") 5 | yc_webpage = response.text 6 | 7 | soup = BeautifulSoup(yc_webpage, "html.parser") 8 | articles = soup.find_all(name="a", class_="titlelink") 9 | article_texts = [] 10 | article_links = [] 11 | 12 | for article_tag in articles: 13 | text = article_tag.getText() 14 | article_texts.append(text) 15 | link = article_tag.get("href") 16 | article_links.append(link) 17 | 18 | article_upvotes = [int(score.getText().split()[0]) for score in soup.find_all(name="span", class_="score")] 19 | 20 | print(article_texts) 21 | print(article_links) 22 | print(article_upvotes) 23 | 24 | max_upvote = max(article_upvotes) 25 | print(article_texts[article_upvotes.index(max_upvote)]) -------------------------------------------------------------------------------- /Day 45/website.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 |Founder of The App Brewery.
12 |I am an iOS and Web Developer. I ❤️ coffee and motorcycles.
13 |{{ post["body"]}}
19 |Maps Link | 27 | {% else %} 28 |{{ item }} | 29 | {% endif %} 30 | {% endfor %} 31 |
Want to work in a cafe but need power and wifi?
18 |You've found the right place! Checkout my collection of cafes with data on power socket availability, wifi speed and coffee quality.
20 | Show Me! 21 |Library is empty.
11 | {% endif %} 12 |Edit Movie Rating
17 | {{ wtf.quick_form(form, novalidate=True) }} 18 |Lorem ipsum dolor sit amet, consectetur adipisicing elit. Saepe nostrum ullam eveniet pariatur voluptates odit, fuga atque ea nobis sit soluta odio, adipisci quas excepturi maxime quae totam ducimus consectetur?
23 |Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius praesentium recusandae illo eaque architecto error, repellendus iusto reprehenderit, doloribus, minus sunt. Numquam at quae voluptatum in officia voluptas voluptatibus, minus!
24 |Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut consequuntur magnam, excepturi aliquid ex itaque esse est vero natus quae optio aperiam soluta voluptatibus corporis atque iste neque sit tempora!
25 |Since 2018, I have been studying and working in the fields of Python, Javascript and Web Development. I also 23 | made projects to be used in related places. In order to stay fresh, I continue to work and develop by using 24 | different sources.
25 |{{ message }}
30 | {% endfor %} 31 | {% endif %} 32 | {% endwith %} 33 | {{ wtf.quick_form(form, novalidate=True, button_map={"submit": "primary"}) }} 34 |