├── Day 10 Calculator with Recursion ├── Readme.md ├── art.py └── main.py ├── Day 11 BlackJack Game ├── Project.py ├── Readme.md └── art.py ├── Day 12 Number Guessing Game ├── Number Guessing Game.py ├── Readme.md └── art.py ├── Day 13 Debugging ├── Code with Bugs.py ├── README.md └── Solved Code.py ├── Day 14 Higher Lower Followers Game ├── README.md ├── art.py ├── game_data.py └── main.py ├── Day 15 Coffee Machine Code ├── Coffee Machine.py ├── Menu.py └── README.md ├── Day 16: Coffee Machine OOP ├── Coffee Maker Documentation OOP.pdf ├── README.md ├── coffee_maker.py ├── main.py ├── menu.py └── money_machine.py ├── Day 17 QuizGame OOP ├── README.md ├── data.py ├── main.py ├── question_model.py └── quiz_brain.py ├── Day 18 Hirst Painting Project ├── FinalOutput.PNG ├── README.md └── main.py ├── Day 19 Turtle Race Game ├── README.md ├── main.py └── turtle race output.PNG ├── Day 1: Band Name Generator.py ├── Day 20-21 Arcade Snake Game ├── README.md ├── Snake Game.PNG ├── food.py ├── main.py ├── scoreboard.py └── snake.py ├── Day 22 Arcade Pong Game ├── Game Output.PNG ├── README.md ├── ball.py ├── main.py ├── paddle.py └── scoreboard.py ├── Day 23 Turtle Crossing Game ├── Game Output.PNG ├── README.md ├── car_manager.py ├── main.py ├── player.py └── scoreboard.py ├── Day 24 Mail Merge Project ├── Day 24 Mail Merge Project.py ├── Input │ └── Letters │ │ └── starting_letter.txt ├── Names │ └── invited_names.txt └── README.md ├── Day 25 US State Game ├── 50_states.csv ├── README.md ├── US State Game Output.PNG ├── blank_states_img.gif ├── main.py └── states_to_learn ├── Day 26 NATO Alphabet Project ├── Output.PNG ├── README.md ├── main.py └── nato_phonetic_alphabet.csv ├── Day 27 Km to Miles Converter GUI Project ├── README.md └── main.py ├── Day 28 Pomodoro Timer ├── Output.PNG ├── README.md └── main.py ├── Day 29 Password Manager Application ├── README.md └── main.py ├── Day 2: Tip Calculator.py ├── Day 30 Exception Handling ├── README.md ├── logo.png └── main.py ├── Day 31 Flash Card Application ├── README.md ├── data │ └── french_words.csv ├── images │ ├── card_back.png │ ├── card_front.png │ ├── right.png │ └── wrong.png └── main.py ├── Day 32 Email Automation using SMTP ├── README.md ├── birthdays.csv ├── letter_templates │ ├── letter_1.txt │ ├── letter_2.txt │ └── letter_3.txt └── main.py ├── Day 33 Working with APIs ├── ISS_TRACKER.py ├── README.md └── Sunrise&Sunset.py ├── Day 34 Quizzler App with OpenTrivia API ├── Output.PNG ├── README.md ├── data.py ├── main.py ├── question_model.py ├── quiz_brain.py └── ui.py ├── Day 35 Rain Alert App with Twilio and OpenWeather API ├── README.md └── main.py ├── Day 36 Tesla Stock News Monitoring Project ├── Message Output on Phone.jpg ├── README.md └── main.py ├── Day 37 Habit Tracker using Pixela API ├── Output.PNG ├── README.md └── main.py ├── Day 38 Workout Tracker With Python & Google Sheets ├── README.md └── main.py ├── Day 39-40 Flight Club ├── README.md ├── data_manager.py ├── flight_data.py ├── flight_search.py ├── main.py └── notification_manager.py ├── Day 3: Interactive Treasure Island Story Game.py ├── Day 41 Web Foundation: Intro to HTML ├── README.md ├── contactMe.html ├── hobbies.html ├── index.html └── prachet.png ├── Day 42,43 and 44 └── README.md ├── Day 45 Intro to Web Scraping using BeautifulSoup ├── README.md ├── main.py └── website.html ├── Day 46 Musical Time Machine using SpotifyDeveloper ├── README.md └── main.py ├── Day 47 Amazon Price Tracker Bot ├── README.md └── main.py ├── Day 48 Selenium Web Scraping ├── README.md └── main.py ├── Day 4: Rock Paper Scissors with Computer.py ├── Day 50 Tinder Swiping Bot ├── README.md └── main.py ├── Day 51 Twitter Complaint Bot ├── README.md └── Twitter_Bot.py ├── Day 52 Instagram Follower Bot ├── Insta_Follow_Bot.py └── README.md ├── Day 53 Data Entry Job Automation ├── README.md └── main.py ├── Day 54 Starting with Flask ├── README.md └── hello.py ├── Day 55 Rendering HTML in Flask ├── README.md └── server.py ├── Day 56 Advanced Rendering ├── README.md ├── site.py ├── static │ ├── css │ │ └── styles.css │ ├── favicon.ico │ └── images │ │ ├── cloud.png │ │ ├── mountain.png │ │ └── prachet.png └── templates │ └── index.html ├── Day 57 Templating with Jinja ├── README.md ├── server.py └── templates │ ├── blog.html │ ├── index.html │ └── predict.html ├── Day 58 Bootstrap ├── README.md └── TinDog Start Here │ ├── css │ └── styles.css │ ├── favicon.ico │ ├── images │ ├── TechCrunch.png │ ├── bizinsider.png │ ├── dog-img.jpg │ ├── iphone6.png │ ├── lady-img.jpg │ ├── mashable.png │ └── tnw.png │ └── index.html ├── Day 59 Updating Blog App ├── README.md ├── 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 5: Random Password Generator.py ├── Day 60 Adding Functionality to HTML Forms with Flask Request ├── README.md ├── main.py └── templates │ └── index.html ├── Day 61 Flask-WTForms ├── README.md ├── main.py ├── requirements.txt └── templates │ ├── base.html │ ├── denied.html │ ├── index.html │ ├── login.html │ └── success.html ├── Day 62 Flask Bootstrap CSS ├── README.md ├── cafe-data.csv ├── main.py ├── requirements.txt ├── static │ └── css │ │ └── styles.css └── templates │ ├── add.html │ ├── cafes.html │ └── index.html ├── Day 63 Databases and with SQLite and SQLAlchemy ├── README.md ├── books.db ├── main.py ├── requirements.txt └── templates │ ├── add.html │ ├── edit_rating.html │ └── index.html ├── Day 64 Top 10 Movies Website with Flask ├── README.md ├── main.py ├── movies.db ├── static │ └── css │ │ └── styles.css └── templates │ ├── add.html │ ├── edit.html │ ├── index.html │ └── select.html ├── Day 65 Design School └── README.md ├── Day 66 Building REST API └── README.md ├── Day 67 RESTful Blog Page └── README.md ├── Day 68-70 └── README.md ├── Day 6: Escaping the Maze ├── Day 7 Hangman Project ├── hangman_art.py ├── hangman_words.py └── main.py ├── Day 71 Data Exploration with Pandas of College Major Program └── README.md ├── Day 72 Analysins Popular Programming Languages └── Analysis_of_Popular_Programming_Languages.ipynb ├── Day 73 Aggregate and Merge Data with Pandas, Analysing LEGO Dataset └── README.md ├── Day 74 Resamling and Visualising Data, Working with Google Trends Data └── README.md ├── Day 75 Android Store Trends └── README.md ├── Day 76 Computation with NumPy └── README.md ├── Day 77 Linear Regression and Seaborn └── README.md ├── Day 78 Analyzing Nobel Prizes └── README.md ├── Day 79 Discovery of Handwashing └── README.md ├── Day 8 Caesar Cipher Project ├── art.py └── main.py ├── Day 80 House Price Prediction └── README.md ├── Day 81 Text to Morse Code Converter ├── README.md └── main.py ├── Day 82 Personal Portfolio Website └── README.md ├── Day 83 Tic Tac Toe └── README.md ├── Day 84 Watermarking App └── README.md ├── Day 9 Blind Auction Project ├── Readme.md ├── art.py └── main.py └── README.md /Day 10 Calculator with Recursion/Readme.md: -------------------------------------------------------------------------------- 1 | In this project, i created a calculator by using concepts of dictionaries, recursions and functions and loops. 2 | -------------------------------------------------------------------------------- /Day 10 Calculator with Recursion/art.py: -------------------------------------------------------------------------------- 1 | logo = """ 2 | _____________________ 3 | | _________________ | 4 | | | Python Calc 0. | | .----------------. .----------------. .----------------. .----------------. 5 | | |_________________| | | .--------------. || .--------------. || .--------------. || .--------------. | 6 | | ___ ___ ___ ___ | | | ______ | || | __ | || | _____ | || | ______ | | 7 | | | 7 | 8 | 9 | | + | | | | .' ___ | | || | / \ | || | |_ _| | || | .' ___ | | | 8 | | |___|___|___| |___| | | | / .' \_| | || | / /\ \ | || | | | | || | / .' \_| | | 9 | | | 4 | 5 | 6 | | - | | | | | | | || | / ____ \ | || | | | _ | || | | | | | 10 | | |___|___|___| |___| | | | \ `.___.'\ | || | _/ / \ \_ | || | _| |__/ | | || | \ `.___.'\ | | 11 | | | 1 | 2 | 3 | | x | | | | `._____.' | || ||____| |____|| || | |________| | || | `._____.' | | 12 | | |___|___|___| |___| | | | | || | | || | | || | | | 13 | | | . | 0 | = | | / | | | '--------------' || '--------------' || '--------------' || '--------------' | 14 | | |___|___|___| |___| | '----------------' '----------------' '----------------' '----------------' 15 | |_____________________| 16 | """ 17 | -------------------------------------------------------------------------------- /Day 10 Calculator with Recursion/main.py: -------------------------------------------------------------------------------- 1 | from replit import clear 2 | from art import logo 3 | 4 | def add(n1, n2): 5 | return n1 + n2 6 | 7 | def subtract(n1, n2): 8 | return n1 - n2 9 | 10 | def multiply(n1, n2): 11 | return n1 * n2 12 | 13 | def divide(n1, n2): 14 | return n1 / n2 15 | 16 | operations = { 17 | "+": add, 18 | "-": subtract, 19 | "*": multiply, 20 | "/": divide 21 | } 22 | 23 | def calculator(): 24 | print(logo) 25 | 26 | num1 = float(input("What's the first number?: ")) 27 | for symbol in operations: 28 | print(symbol) 29 | should_continue = True 30 | 31 | while should_continue: 32 | operation_symbol = input("Pick an operation: ") 33 | num2 = float(input("What's the next number?: ")) 34 | calculation_function = operations[operation_symbol] 35 | answer = calculation_function(num1, num2) 36 | print(f"{num1} {operation_symbol} {num2} = {answer}") 37 | 38 | if input(f"Type 'y' to continue calculating with {answer}, or type 'n' to start a new calculation: ") == 'y': 39 | num1 = answer 40 | else: 41 | should_continue = False 42 | clear() 43 | calculator() 44 | 45 | calculator() 46 | -------------------------------------------------------------------------------- /Day 11 BlackJack Game/Project.py: -------------------------------------------------------------------------------- 1 | import random 2 | from art import logo 3 | cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10] 4 | 5 | def deal_card(): 6 | return random.choice(cards) 7 | 8 | def calculate_score(a_list): 9 | """Take a list of cards and return the sum of those cards""" 10 | if sum(a_list) == 21 and len(a_list) == 2: 11 | # print("Blackjack") 12 | return 0 #0 represents blackjack in our game 13 | if 11 in a_list and sum(a_list) > 21: 14 | a_list.remove(11) 15 | a_list.append(1) 16 | return sum(a_list) 17 | 18 | user_win = 0 19 | comp_win = 0 20 | 21 | def compare(user_score,computer_score): 22 | global user_win 23 | global comp_win 24 | if user_score == computer_score: 25 | user_win += 1 26 | return "\nDraw 🙃" 27 | elif computer_score == 0: 28 | comp_win += 1 29 | return "\nLose, opponent has BlackJack 😱" 30 | elif user_score == 0: 31 | user_win += 1 32 | return "\nWin with a BlackJack 😎" 33 | elif user_score > 21: 34 | comp_win += 1 35 | return "\nYou went over. You Lose 😭" 36 | elif computer_score > 21: 37 | user_win += 1 38 | return "\nOpponent Went Over, You Win 😁" 39 | elif user_score > computer_score : 40 | user_win += 1 41 | return "\nYou Win, your score is higher 😌" 42 | else: 43 | comp_win += 1 44 | return "\nYou Lose, your score is lower than computer's ☹️" 45 | 46 | def play_game(): 47 | user_cards, computer_cards = [], [] 48 | is_game_over = False 49 | #add 2 random cards to user and computers hand 50 | for _ in range(2): 51 | user_cards.append(deal_card()) 52 | computer_cards.append(deal_card()) 53 | 54 | while not is_game_over: 55 | 56 | user_score = calculate_score(user_cards) 57 | computer_score = calculate_score(computer_cards) 58 | print(f"User Cards: {user_cards} and Current Score : {user_score}") 59 | print(f" Computer Card : {computer_cards[0]} ") 60 | if user_score == 0 or computer_score == 0 or user_score > 21: 61 | is_game_over = True 62 | else: 63 | user_should_deal = input("Type 'y' to get another card , type'n' to pass :") 64 | if user_should_deal == 'y': 65 | user_cards.append(deal_card()) 66 | else: 67 | is_game_over = True 68 | 69 | while(computer_score !=0 and computer_score < 17): 70 | computer_cards.append(deal_card()) 71 | computer_score = calculate_score(computer_cards) 72 | print(f"\n Your final hand : {user_cards}, final score : {user_score}") 73 | print(f" Computer final hand : {computer_cards}, final score : {computer_score}") 74 | print(compare(user_score,computer_score)) 75 | 76 | print(logo) 77 | while input("\nDo you want to play a game of BlackJack? Type 'y' or 'n' :") == 'y': 78 | play_game() 79 | print(f" You have won {user_win} times and computer has won {comp_win} times ") 80 | from art import thanks 81 | print(thanks) 82 | 83 | -------------------------------------------------------------------------------- /Day 11 BlackJack Game/Readme.md: -------------------------------------------------------------------------------- 1 | BlackJack / 21 Game in Python, 2 |
Rules of BlackJack:
3 |
Players are each dealt two cards, individually facing up or down depending on the casino and the table. In the U.S., the dealer is also dealt two cards, normally one up (exposed) and one down (hidden). In most other countries, the dealer only receives one card face up. The value of cards two through ten is their pip value (2 through 10). Face cards (Jack, Queen, and King) are all worth ten. Aces can be worth one or eleven. A hand's value is the sum of the card values. Players are allowed to draw additional cards to improve their hands. A hand with an ace valued as 11 is called "soft", meaning that the hand will be guaranteed to not score more than 21 by taking an additional card. The value of the ace will become one to prevent the hand from exceeding 21. Otherwise, the hand is called "hard".
4 | 5 | Once all the players have completed their hands, it is the dealer's turn. The dealer hand will not be completed if all players have either exceeded the total of 21 or received blackjacks. The dealer then reveals the hidden card and must draw cards, one by one, until the cards total up to 17 points. At 17 points or higher the dealer must stop. (At most tables the dealer also hits on a "soft" 17, i.e. a hand containing an ace and one or more other cards totaling six.) Players bet on the basis that they will individually have better hands than the dealer. The better hand is the hand where the sum of the card values is closer to 21 without exceeding 21. The detailed outcome of the hand follows:
6 | 7 | If the player is dealt an Ace and a ten-value card (called a "blackjack" or "natural"), and the dealer does not, the player wins and usually receives a bonus.
8 | If the player exceeds a sum of 21 ("busts"), the player loses, even if the dealer also exceeds 21.
9 | If the dealer exceeds 21 ("busts") and the player does not, the player wins.
10 | If the player attains a final sum higher than the dealer and does not bust, the player wins.
11 | If both dealer and player receive a blackjack or any other hands with the same sum, this will be called a "push" and no one wins.
12 | -------------------------------------------------------------------------------- /Day 11 BlackJack Game/art.py: -------------------------------------------------------------------------------- 1 | logo = """ 2 | .------. _ _ _ _ _ 3 | |A_ _ |. | | | | | | (_) | | 4 | |( \/ ).-----. | |__ | | __ _ ___| | ___ __ _ ___| | __ 5 | | \ /|K /\ | | '_ \| |/ _` |/ __| |/ / |/ _` |/ __| |/ / 6 | | \/ | / \ | | |_) | | (_| | (__| <| | (_| | (__| < 7 | `-----| \ / | |_.__/|_|\__,_|\___|_|\_\ |\__,_|\___|_|\_\\ 8 | | \/ K| _/ | 9 | `------' |__/ 10 | """ 11 | 12 | thanks = """ 13 | ████████╗██╗ ██╗ █████╗ ███╗ ██╗██╗ ██╗ ██╗ ██╗ ██████╗ ██╗ ██╗ 14 | ╚══██╔══╝██║ ██║██╔══██╗████╗ ██║██║ ██╔╝ ╚██╗ ██╔╝██╔═══██╗██║ ██║ 15 | ██║ ███████║███████║██╔██╗ ██║█████╔╝ ╚████╔╝ ██║ ██║██║ ██║ 16 | ██║ ██╔══██║██╔══██║██║╚██╗██║██╔═██╗ ╚██╔╝ ██║ ██║██║ ██║ 17 | ██║ ██║ ██║██║ ██║██║ ╚████║██║ ██╗ ██║ ╚██████╔╝╚██████╔╝ 18 | ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ 19 | 20 | ███████╗ ██████╗ ██████╗ ██████╗ ██╗ █████╗ ██╗ ██╗██╗███╗ ██╗ ██████╗ 21 | ██╔════╝██╔═══██╗██╔══██╗ ██╔══██╗██║ ██╔══██╗╚██╗ ██╔╝██║████╗ ██║██╔════╝ 22 | █████╗ ██║ ██║██████╔╝ ██████╔╝██║ ███████║ ╚████╔╝ ██║██╔██╗ ██║██║ ███╗ 23 | ██╔══╝ ██║ ██║██╔══██╗ ██╔═══╝ ██║ ██╔══██║ ╚██╔╝ ██║██║╚██╗██║██║ ██║ 24 | ██║ ╚██████╔╝██║ ██║ ██║ ███████╗██║ ██║ ██║ ██║██║ ╚████║╚██████╔╝ 25 | ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ 26 | """ 27 | -------------------------------------------------------------------------------- /Day 12 Number Guessing Game/Number Guessing Game.py: -------------------------------------------------------------------------------- 1 | from art import logo 2 | print(logo) 3 | import random 4 | 5 | print("Welcome to Number Guessing Game") 6 | print("I am choosing a number from 1 to 100") 7 | num_choice = random.choice(range(1,101)) 8 | 9 | response = input("Enter which level : 'easy' or 'hard' :") 10 | 11 | def easy(): 12 | is_game_over = False 13 | attempts = 10 14 | print(f"You have {attempts} to clear this stage") 15 | num_choice = random.choice(range(1, 101)) 16 | while not is_game_over: 17 | if attempts == 0: 18 | is_game_over = True 19 | print("Game Over , You Lose") 20 | num = int(input("\nGuess a Number :")) 21 | 22 | if(num > num_choice): 23 | attempts -= 1 24 | print("Too High, Guess Lower") 25 | print(f"You have {attempts} attempts left") 26 | elif(num < num_choice): 27 | attempts -= 1 28 | print("Too Low, Guess Higher") 29 | print(f"You have {attempts} attempts left") 30 | elif(num == num_choice): 31 | print(f"Great Job, you guessed it correct ,the number was {num_choice}") 32 | is_game_over = True 33 | 34 | 35 | def hard(): 36 | is_game_over = False 37 | attempts = 5 38 | print(f"You have {attempts} attempts to clear this stage") 39 | num_choice = random.choice(range(1, 101)) 40 | while not is_game_over: 41 | if attempts == 0: 42 | is_game_over = True 43 | print("Game Over , You Lose") 44 | num = int(input("\nGuess a Number :")) 45 | if (num > num_choice): 46 | attempts -= 1 47 | print("Too High, Guess Lower") 48 | print(f"You have {attempts} attempts left") 49 | elif (num < num_choice): 50 | attempts -= 1 51 | print("Too Low, Guess Higher") 52 | print(f"You have {attempts} attempts left") 53 | elif (num == num_choice): 54 | print(f"Great Job, you guessed it correct ,the number was {num_choice}") 55 | is_game_over = True 56 | 57 | if response == 'easy': 58 | easy() 59 | elif response == 'hard': 60 | hard() 61 | else: 62 | print("Enter Valid Option") 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /Day 12 Number Guessing Game/Readme.md: -------------------------------------------------------------------------------- 1 | Number Guessing Game With Computer
2 | -------------------------------------------------------------------------------- /Day 12 Number Guessing Game/art.py: -------------------------------------------------------------------------------- 1 | logo =""" 2 | ███╗ ██╗██╗ ██╗███╗ ███╗██████╗ ███████╗██████╗ ██████╗ ██╗ ██╗███████╗███████╗███████╗██╗███╗ ██╗ ██████╗ 3 | ████╗ ██║██║ ██║████╗ ████║██╔══██╗██╔════╝██╔══██╗ ██╔════╝ ██║ ██║██╔════╝██╔════╝██╔════╝██║████╗ ██║██╔════╝ 4 | ██╔██╗ ██║██║ ██║██╔████╔██║██████╔╝█████╗ ██████╔╝ ██║ ███╗██║ ██║█████╗ ███████╗███████╗██║██╔██╗ ██║██║ ███╗ 5 | ██║╚██╗██║██║ ██║██║╚██╔╝██║██╔══██╗██╔══╝ ██╔══██╗ ██║ ██║██║ ██║██╔══╝ ╚════██║╚════██║██║██║╚██╗██║██║ ██║ 6 | ██║ ╚████║╚██████╔╝██║ ╚═╝ ██║██████╔╝███████╗██║ ██║ ╚██████╔╝╚██████╔╝███████╗███████║███████║██║██║ ╚████║╚██████╔╝ 7 | ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝ 8 | 9 | ██████╗ █████╗ ███╗ ███╗███████╗ 10 | ██╔════╝ ██╔══██╗████╗ ████║██╔════╝ 11 | ██║ ███╗███████║██╔████╔██║█████╗ 12 | ██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ 13 | ╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗ 14 | ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ 15 | """ -------------------------------------------------------------------------------- /Day 13 Debugging/Code with Bugs.py: -------------------------------------------------------------------------------- 1 | ###########DEBUGGING##################### 2 | 3 | # Describe Problem 4 | def my_function(): 5 | for i in range(1, 20): 6 | if i == 20: 7 | print("You got it") 8 | my_function() 9 | 10 | # Reproduce the Bug 11 | from random import randint 12 | dice_imgs = ["❶", "❷", "❸", "❹", "❺", "❻"] 13 | dice_num = randint(1, 6) 14 | print(dice_imgs[dice_num]) 15 | 16 | # Play Computer 17 | year = int(input("What's your year of birth?")) 18 | if year > 1980 and year < 1994: 19 | print("You are a millenial.") 20 | elif year > 1994: 21 | print("You are a Gen Z.") 22 | 23 | # Fix the Errors 24 | age = input("How old are you?") 25 | if age > 18: 26 | print("You can drive at age {age}.") 27 | 28 | #Print is Your Friend 29 | pages = 0 30 | word_per_page = 0 31 | pages = int(input("Number of pages: ")) 32 | word_per_page == int(input("Number of words per page: ")) 33 | total_words = pages * word_per_page 34 | print(total_words) 35 | 36 | #Use a Debugger 37 | def mutate(a_list): 38 | b_list = [] 39 | for item in a_list: 40 | new_item = item * 2 41 | b_list.append(new_item) 42 | print(b_list) 43 | 44 | mutate([1,2,3,5,8,13]) 45 | -------------------------------------------------------------------------------- /Day 13 Debugging/README.md: -------------------------------------------------------------------------------- 1 | Learned some Debugging Concepts Today 2 | -------------------------------------------------------------------------------- /Day 13 Debugging/Solved Code.py: -------------------------------------------------------------------------------- 1 | ###########DEBUGGING##################### 2 | 3 | # Describe Problem 4 | def my_function(): 5 | for i in range(1, 21): 6 | if i == 20: 7 | print("You got it") 8 | my_function() 9 | 10 | # Reproduce the Bug 11 | from random import randint 12 | dice_imgs = ["❶", "❷", "❸", "❹", "❺", "❻"] 13 | dice_num = randint(0, 5) 14 | print(dice_imgs[dice_num]) 15 | 16 | # Play Computer 17 | year = int(input("What's your year of birth?")) 18 | if year > 1980 and year < 1994: 19 | print("You are a millenial.") 20 | elif year >= 1994: 21 | print("You are a Gen Z.") 22 | 23 | # Fix the Errors 24 | age = int(input("How old are you?")) 25 | if age > 18: 26 | print(f"You can drive at age {age}.") 27 | 28 | #Print is Your Friend 29 | pages = 0 30 | word_per_page = 0 31 | pages = int(input("Number of pages: ")) 32 | word_per_page = int(input("Number of words per page: ")) 33 | total_words = pages * word_per_page 34 | print(total_words) 35 | 36 | #Use a Debugger 37 | def mutate(a_list): 38 | b_list = [] 39 | for item in a_list: 40 | new_item = item * 2 41 | b_list.append(new_item) 42 | print(b_list) 43 | 44 | mutate([1,2,3,5,8,13]) 45 | -------------------------------------------------------------------------------- /Day 14 Higher Lower Followers Game/README.md: -------------------------------------------------------------------------------- 1 | Instagram Higher Lower Followers Game
2 | Main Objective of the game is to guess which person has higher followers 3 | -------------------------------------------------------------------------------- /Day 14 Higher Lower Followers Game/art.py: -------------------------------------------------------------------------------- 1 | logo = """ 2 | __ ___ __ 3 | / / / (_)___ _/ /_ ___ _____ 4 | / /_/ / / __ `/ __ \/ _ \/ ___/ 5 | / __ / / /_/ / / / / __/ / 6 | /_/ ///_/\__, /_/ /_/\___/_/ 7 | / / /____/_ _____ _____ 8 | / / / __ \ | /| / / _ \/ ___/ 9 | / /___/ /_/ / |/ |/ / __/ / 10 | /_____/\____/|__/|__/\___/_/ 11 | """ 12 | 13 | vs = """ 14 | _ __ 15 | | | / /____ 16 | | | / / ___/ 17 | | |/ (__ ) 18 | |___/____(_) 19 | """ 20 | 21 | thanks = """ 22 | _____ _ _ 23 | /__ \ |__ __ _ _ __ | | __ /\_/\___ _ _ 24 | / /\/ '_ \ / _` | '_ \| |/ / \_ _/ _ \| | | | 25 | / / | | | | (_| | | | | < / \ (_) | |_| | 26 | \/ |_| |_|\__,_|_| |_|_|\_\ \_/\___/ \__,_| 27 | 28 | ___ ___ _ _ 29 | / __\__ _ __ / _ \ | __ _ _ _(_)_ __ __ _ 30 | / _\/ _ \| '__| / /_)/ |/ _` | | | | | '_ \ / _` | 31 | / / | (_) | | / ___/| | (_| | |_| | | | | | (_| | 32 | \/ \___/|_| \/ |_|\__,_|\__, |_|_| |_|\__, | 33 | |___/ |___/ 34 | """ 35 | -------------------------------------------------------------------------------- /Day 14 Higher Lower Followers Game/main.py: -------------------------------------------------------------------------------- 1 | from game_data import data 2 | import random 3 | from art import logo, vs, thanks 4 | from replit import clear 5 | 6 | def random_account(): 7 | """Get data from random account""" 8 | return random.choice(data) 9 | 10 | def format_data(account): 11 | """Format account into printable format: name, description and country""" 12 | name = account["name"] 13 | description = account["description"] 14 | country = account["country"] 15 | # print(f'{name}: {account["follower_count"]}') 16 | return f"{name}, a {description}, from {country}" 17 | 18 | def check_answer(response, a_followers, b_followers): 19 | """Checks followers against user's guess 20 | and returns True if they got it right. 21 | Or False if they got it wrong.""" 22 | if a_followers > b_followers: 23 | return response == "a" 24 | else: 25 | return response == "b" 26 | 27 | 28 | def game(): 29 | print(logo) 30 | score = 0 31 | game_should_continue = True 32 | account_a = random_account() 33 | account_b = random_account() 34 | 35 | while game_should_continue: 36 | account_a = account_b 37 | account_b = random_account() 38 | 39 | while account_a == account_b: 40 | account_b = random_account() 41 | 42 | print(f"Compare A: {format_data(account_a)}.") 43 | print(vs) 44 | print(f"Against B: {format_data(account_b)}.") 45 | 46 | guess = input("Who has more followers? Type 'A' or 'B': ").lower() 47 | a_follower_count = account_a["follower_count"] 48 | b_follower_count = account_b["follower_count"] 49 | is_correct = check_answer(guess, a_follower_count, b_follower_count) 50 | 51 | clear() 52 | print(logo) 53 | if is_correct: 54 | score += 1 55 | print(f"You're right! Current score: {score}.\n") 56 | else: 57 | game_should_continue = False 58 | print(f"Sorry, that's wrong. Final score: {score}\n") 59 | print(thanks) 60 | 61 | game() 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /Day 15 Coffee Machine Code/Coffee Machine.py: -------------------------------------------------------------------------------- 1 | 2 | #Importing Data 3 | profit = 0 4 | from Menu import resources,MENU 5 | 6 | # TODO: 4 Check resources sufficient? 7 | def check_resources(order): 8 | """Returns True when orden can be made, False if ingredients missing""" 9 | for item in order: 10 | if order[item] > resources[item]: 11 | print(f"Sorry there is not enough {item}") 12 | return False 13 | return True 14 | 15 | # TODO: 5 Process coins 16 | def process_coins(): 17 | """Returns the total calculated from coins inserted""" 18 | print("Please insert coins.") 19 | quarter = 0.25 * int(input("Enter Quarters : $")) 20 | dime = 0.1 * int(input("Enter Dimes : $")) 21 | nickel = 0.05 * int(input("Enter Nickels : $")) 22 | penny = 0.01 * int(input("Enter Pennies : $")) 23 | total_cash = quarter + dime + nickel + penny 24 | return total_cash 25 | 26 | # TODO: 6 Check transaction successful? 27 | def transaction_success(money_received, drink_cost): 28 | if money_received >= drink_cost: 29 | change = round(money_received - drink_cost, 2) 30 | print(f"Here is the ${change} in change") 31 | global profit 32 | profit += drink_cost 33 | return True 34 | else: 35 | print("Sorry thats not enough. Money Refunded") 36 | return False 37 | 38 | # TODO: 7 Make Coffee. 39 | def make_coffee(drink_name, order): 40 | """remove the ingredients from resources to make coffee""" 41 | for item in order: 42 | resources[item] -= order[item] 43 | print(f"Here is your {drink_name} ☕️. Enjoy!") 44 | 45 | 46 | # TODO: 2 Turn off the Coffee Machine by entering “off” to the prompt 47 | # TODO: 3 Print report. 48 | shut_down = False 49 | while not shut_down: 50 | response = input("What would you like? (espresso/latte/cappuccino): ") 51 | if response == 'off': 52 | print("Under Maintenance") 53 | shut_down = True 54 | elif response == 'report': 55 | print(f"Water: {resources['water']}ml") 56 | print(f"Milk: {resources['milk']}ml") 57 | print(f"Coffee: {resources['coffee']}g") 58 | print(f"Money: ${profit}") 59 | else: 60 | drink = MENU[response] 61 | if check_resources(drink['ingredients']): 62 | payment = process_coins() 63 | if transaction_success(payment, drink["cost"]): 64 | make_coffee(response, drink['ingredients']) 65 | 66 | -------------------------------------------------------------------------------- /Day 15 Coffee Machine Code/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 | 27 | resources = { 28 | "water": 300, 29 | "milk": 200, 30 | "coffee": 100, 31 | } 32 | 33 | -------------------------------------------------------------------------------- /Day 15 Coffee Machine Code/README.md: -------------------------------------------------------------------------------- 1 | Coffee Machine Code in Python which checks for ingredients ,shows types of coffees , checks for transactions and makes coffees by deducting ingredients 2 | -------------------------------------------------------------------------------- /Day 16: Coffee Machine OOP/Coffee Maker Documentation OOP.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 16: Coffee Machine OOP/Coffee Maker Documentation OOP.pdf -------------------------------------------------------------------------------- /Day 16: Coffee Machine OOP/README.md: -------------------------------------------------------------------------------- 1 | Coffee Machine Program in OOP method with Documentation 2 | -------------------------------------------------------------------------------- /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 | shut_down = False 10 | 11 | while not shut_down: 12 | choice = input(f"What would you like? ({menu.get_items()}): ") 13 | if choice == "off": 14 | shut_down = True 15 | elif choice == "report": 16 | coffee_maker.report() 17 | money_machine.report() 18 | else: 19 | drink = menu.find_drink(choice) 20 | enough_ingredients = coffee_maker.is_resource_sufficient(drink) 21 | payment_successful = money_machine.make_payment(drink.cost) 22 | if enough_ingredients and payment_successful: 23 | coffee_maker.make_coffee(drink) 24 | -------------------------------------------------------------------------------- /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 | 3 | CURRENCY = "$" 4 | 5 | COIN_VALUES = { 6 | "quarters": 0.25, 7 | "dimes": 0.10, 8 | "nickles": 0.05, 9 | "pennies": 0.01 10 | } 11 | 12 | def __init__(self): 13 | self.profit = 0 14 | self.money_received = 0 15 | 16 | def report(self): 17 | """Prints the current profit""" 18 | print(f"Money: {self.CURRENCY}{self.profit}") 19 | 20 | def process_coins(self): 21 | """Returns the total calculated from coins inserted.""" 22 | print("Please insert coins.") 23 | for coin in self.COIN_VALUES: 24 | self.money_received += int(input(f"How many {coin}?: ")) * self.COIN_VALUES[coin] 25 | return self.money_received 26 | 27 | def make_payment(self, cost): 28 | """Returns True when payment is accepted, or False if insufficient.""" 29 | self.process_coins() 30 | if self.money_received >= cost: 31 | change = round(self.money_received - cost, 2) 32 | print(f"Here is {self.CURRENCY}{change} in change.") 33 | self.profit += cost 34 | self.money_received = 0 35 | return True 36 | else: 37 | print("Sorry that's not enough money. Money refunded.") 38 | self.money_received = 0 39 | return False 40 | -------------------------------------------------------------------------------- /Day 17 QuizGame OOP/README.md: -------------------------------------------------------------------------------- 1 | Quiz Game which tracks score using OOP 2 | -------------------------------------------------------------------------------- /Day 17 QuizGame OOP/data.py: -------------------------------------------------------------------------------- 1 | question_data = [ 2 | {"category": "Science & Nature", 3 | "type": "boolean", 4 | "difficulty": "easy", 5 | "question": "Igneous rocks are formed by excessive heat and pressure.", 6 | "correct_answer": "False", 7 | "incorrect_answers": ["True"]}, 8 | {"category": "Science & Nature", "type": "boolean", "difficulty": "easy", 9 | "question": "Salt is 100% composed of Sodium.", "correct_answer": "False", 10 | "incorrect_answers": ["True"]}, 11 | {"category": "Science & Nature", "type": "boolean", "difficulty": "easy", 12 | "question": "An atom contains a nucleus.", 13 | "correct_answer": "True", "incorrect_answers": ["False"]}, 14 | {"category": "Science & Nature", "type": "boolean", "difficulty": "easy", 15 | "question": "An exothermic reaction is a chemical reaction that releases energy by radiating electricity.", 16 | "correct_answer": "False", "incorrect_answers": ["True"]}, 17 | {"category": "Science & Nature", "type": "boolean", "difficulty": "easy", 18 | "question": "An Astronomical Unit is the distance between Earth and the Moon.", 19 | "correct_answer": "False", 20 | "incorrect_answers": ["True"]}, 21 | {"category": "Science & Nature", "type": "boolean", "difficulty": "easy", 22 | "question": "An average human can go two weeks without water.", 23 | "correct_answer": "False", "incorrect_answers": ["True"]}, 24 | {"category": "Science & Nature", "type": "boolean", "difficulty": "easy", 25 | "question": "Celiac Disease is a disease that effects the heart, causing those effected to be unable to eat meat.", 26 | "correct_answer": "False", "incorrect_answers": ["True"]}, 27 | {"category": "Science & Nature", "type": "boolean", "difficulty": "easy", 28 | "question": "Water always boils at 100°C, 212°F, 373.15K, no matter where you are.", 29 | "correct_answer": "False", "incorrect_answers": ["True"]}, 30 | {"category": "Science & Nature", "type": "boolean", "difficulty": "easy", 31 | "question": "Not including false teeth; A human has two sets of teeth in their lifetime.", 32 | "correct_answer": "True", "incorrect_answers": ["False"]}, 33 | {"category": "Science & Nature", "type": "boolean", "difficulty": "easy", 34 | "question": "A plant that has a life cycle for more than a year is known as an annual.", 35 | "correct_answer": "False", 36 | "incorrect_answers": ["True"]} 37 | ] 38 | -------------------------------------------------------------------------------- /Day 17 QuizGame OOP/main.py: -------------------------------------------------------------------------------- 1 | from question_model import Question 2 | from data import question_data 3 | from quiz_brain import QuizBrain 4 | 5 | question_bank = [] 6 | for question in question_data: 7 | question_text = question['question'] 8 | question_answer = question['correct_answer'] 9 | new_q = Question(question_text, question_answer) 10 | question_bank.append(new_q) 11 | 12 | quiz = QuizBrain(question_bank) 13 | 14 | while quiz.still_has_question(): 15 | quiz.next_question() 16 | 17 | print("You have completed the Quiz") 18 | print(f"You final score is {quiz.score}/{len(quiz.question_list)}") 19 | -------------------------------------------------------------------------------- /Day 17 QuizGame OOP/question_model.py: -------------------------------------------------------------------------------- 1 | class Question: 2 | def __init__(self, text, answer): 3 | self.text = text 4 | self.answer = answer -------------------------------------------------------------------------------- /Day 17 QuizGame OOP/quiz_brain.py: -------------------------------------------------------------------------------- 1 | class QuizBrain: 2 | def __init__(self, question_list): 3 | self.question_number = 0 4 | self.question_list = question_list 5 | self.score = 0 6 | 7 | def still_has_question(self): 8 | return self.question_number < len(self.question_list) 9 | 10 | def next_question(self): 11 | current_question = self.question_list[self.question_number] 12 | self.question_number += 1 13 | user_answer = input(f"Q.{self.question_number} {current_question.text} (True/False): ") 14 | self.check_answer(user_answer, current_question.answer) 15 | 16 | def check_answer(self, user_answer, correct_answer): 17 | if user_answer[0].lower() == correct_answer[0].lower(): 18 | print("You got it right!") 19 | self.score += 1 20 | else: 21 | print("You got it wrong") 22 | print(f"The correct answer was {correct_answer}") 23 | print(f"Your Score is {self.score}/{self.question_number}\n") 24 | -------------------------------------------------------------------------------- /Day 18 Hirst Painting Project/FinalOutput.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 18 Hirst Painting Project/FinalOutput.PNG -------------------------------------------------------------------------------- /Day 18 Hirst Painting Project/README.md: -------------------------------------------------------------------------------- 1 | Hirst Painting Project in Python using turtle Graphics and concept of Tuples 2 | -------------------------------------------------------------------------------- /Day 18 Hirst Painting Project/main.py: -------------------------------------------------------------------------------- 1 | import turtle as turtle_module 2 | import random 3 | 4 | turtle_module.colormode(255) 5 | tim = turtle_module.Turtle() 6 | tim.speed("fastest") 7 | tim.penup() 8 | tim.hideturtle() 9 | color_list = [(202, 164, 109), (238, 240, 245), (150, 75, 49), (223, 201, 135), (52, 93, 124), (172, 154, 40), (140, 30, 19), (133, 163, 185), (198, 91, 71), (46, 122, 86), (72, 43, 35), (145, 178, 148), (13, 99, 71), (233, 175, 164), (161, 142, 158), (105, 74, 77), (55, 46, 50), (183, 205, 171), (36, 60, 74), (18, 86, 90), (81, 148, 129), (148, 17, 20), (14, 70, 64), (30, 68, 100), (107, 127, 153), (174, 94, 97), (176, 192, 209)] 10 | tim.setheading(225) 11 | tim.forward(350) 12 | tim.setheading(0) 13 | number_of_dots = 121 14 | 15 | for dot_count in range(1, number_of_dots + 1): 16 | tim.dot(20, random.choice(color_list)) 17 | tim.forward(50) 18 | 19 | if dot_count % 11 == 0: 20 | tim.setheading(90) 21 | tim.forward(50) 22 | tim.setheading(180) 23 | tim.forward(550) 24 | tim.setheading(0) 25 | 26 | screen = turtle_module.Screen() 27 | screen.exitonclick() 28 | 29 | -------------------------------------------------------------------------------- /Day 19 Turtle Race Game/README.md: -------------------------------------------------------------------------------- 1 | Interactive Turtle Race Game in Turtle Graphics Python 2 | -------------------------------------------------------------------------------- /Day 19 Turtle Race Game/main.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle, Screen 2 | import random 3 | 4 | screen = Screen() 5 | screen.setup(height=400, width=500) 6 | 7 | is_race_on = False 8 | 9 | colors = ['red', 'green', 'yellow', 'orange', 'blue', 'purple'] 10 | y_positions = [150, 100, 50, 0, -50, -100] 11 | 12 | turtles = [] 13 | for i in range(len(colors)): 14 | tim = Turtle(shape="turtle") 15 | tim.color(colors[i]) 16 | tim.penup() 17 | tim.goto(x=-230, y=y_positions[i]) 18 | turtles.append(tim) 19 | 20 | user_bet = screen.textinput(title="Make your bet", prompt="Which turtle will win the race? Enter your color: " 21 | "\n(red, green, yellow, orange, blue, purple)") 22 | if user_bet: 23 | is_race_on = True 24 | 25 | while is_race_on: 26 | for turtle in turtles: 27 | if turtle.xcor() > 230: 28 | is_race_on = False 29 | wining_color = turtle.pencolor() 30 | if wining_color == user_bet: 31 | screen.textinput(f"Thanks for Playing", prompt=f'\nYou won! The {wining_color} turtle is the winner\n' 32 | f'Did you enjoy playing?') 33 | print(f"You' won! The {wining_color} turtle is the winner") 34 | else: 35 | screen.textinput(f"Thanks for Playing", prompt=f'\nYou lost! The {wining_color} turtle is the winner' 36 | f'\nDid you enjoy playing?') 37 | print(f"You' lost! The {wining_color} turtle is the winner") 38 | 39 | rand_distance = random.randint(0, 10) 40 | turtle.forward(rand_distance) 41 | 42 | 43 | screen.exitonclick() 44 | -------------------------------------------------------------------------------- /Day 19 Turtle Race Game/turtle race output.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 19 Turtle Race Game/turtle race output.PNG -------------------------------------------------------------------------------- /Day 1: Band Name Generator.py: -------------------------------------------------------------------------------- 1 | #Link to The Project 2 | 3 | #https://replit.com/@PrachetShah/band-name-generator-start?embed=1&output=1#main.py 4 | 5 | #Code 6 | #1. Create a greeting for your program. 7 | print("Welcome to the Band Name Generator") 8 | #2. Ask the user for the city that they grew up in. 9 | print("What is the city you grow up in? ") 10 | city = input() 11 | #3. Ask the user for the name of a pet. 12 | print("What is name of your pet? ") 13 | pet_name = input() 14 | #4. Combine the name of their city and pet and show them their band name. 15 | print("Your band name could be "+city +" "+pet_name) 16 | -------------------------------------------------------------------------------- /Day 20-21 Arcade Snake Game/README.md: -------------------------------------------------------------------------------- 1 | Arcade Snake Game in Python using Turtle Graphics 2 | -------------------------------------------------------------------------------- /Day 20-21 Arcade Snake Game/Snake Game.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 20-21 Arcade Snake Game/Snake Game.PNG -------------------------------------------------------------------------------- /Day 20-21 Arcade Snake Game/food.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | import random 3 | 4 | class Food(Turtle): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.shape("circle") 9 | self.penup() 10 | #default = 20x20 so, stretch_len = 0.5*20 i.e 10x10 11 | self.shapesize(stretch_len=0.8, stretch_wid=0.8) 12 | self.color("blue") 13 | self.speed("fastest") 14 | self.refresh() 15 | 16 | 17 | def refresh(self): 18 | random_x = random.randint(-280, 280) 19 | random_y = random.randint(-280, 260) 20 | self.goto(random_x, random_y) 21 | 22 | -------------------------------------------------------------------------------- /Day 20-21 Arcade Snake Game/main.py: -------------------------------------------------------------------------------- 1 | from turtle import Screen 2 | import time 3 | from snake import Snake 4 | from food import Food 5 | from scoreboard import Scoreboard 6 | 7 | screen = Screen() 8 | screen.bgcolor("black") 9 | screen.setup(width=600, height=600) 10 | screen.title("Arcade Snake Game") 11 | screen.tracer(0) 12 | 13 | # init 14 | snake = Snake() 15 | food = Food() 16 | scoreboard = Scoreboard() 17 | 18 | screen.listen() 19 | screen.onkey(snake.up, "Up") 20 | screen.onkey(snake.down, "Down") 21 | screen.onkey(snake.left, "Left") 22 | screen.onkey(snake.right, "Right") 23 | 24 | screen.update() 25 | 26 | game_is_on = True 27 | while game_is_on: 28 | screen.update() 29 | time.sleep(0.1) 30 | # move 31 | snake.move() 32 | 33 | # detect collision from food 34 | if snake.head.distance(food) < 18: 35 | food.refresh() 36 | snake.extend() 37 | scoreboard.increase_score() 38 | 39 | # Detect Collision with Wall 40 | if snake.head.xcor() > 285 or snake.head.xcor() < -285 or snake.head.ycor() < -285 or snake.head.ycor() > 285: 41 | game_is_on = False 42 | scoreboard.game_over() 43 | 44 | # Detect collision with tail 45 | # if head collides with any segments of tail trigger game_over 46 | for segment in snake.segments[1:]: 47 | if snake.head.distance(segment) < 10: 48 | game_is_on = False 49 | scoreboard.game_over() 50 | 51 | screen.exitonclick() 52 | -------------------------------------------------------------------------------- /Day 20-21 Arcade Snake Game/scoreboard.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | ALIGNMENT = "center" 3 | FONT = ("Courier", 20, "normal") 4 | 5 | 6 | class Scoreboard(Turtle): 7 | 8 | def __init__(self): 9 | super().__init__() 10 | self.score = 0 11 | self.color("white") 12 | self.penup() 13 | self.goto(0, 270) 14 | self.hideturtle() 15 | self.update_scoreboard() 16 | 17 | def update_scoreboard(self): 18 | self.write(f'Score : {self.score}', align=ALIGNMENT, font=FONT) 19 | 20 | def game_over(self): 21 | self.goto(0,0) 22 | self.write("GAME OVER", align=ALIGNMENT, font=FONT) 23 | 24 | def increase_score(self): 25 | self.score += 1 26 | self.clear() 27 | self.update_scoreboard() 28 | -------------------------------------------------------------------------------- /Day 20-21 Arcade Snake Game/snake.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | STARTING_POSITIONS = [(0, 0), (-20, 0), (-40, 0)] 3 | MOVE_DISTANCE = 20 4 | UP = 90 5 | DOWN = 270 6 | LEFT = 180 7 | RIGHT = 0 8 | 9 | 10 | class Snake: 11 | def __init__(self): 12 | self.segments = [] 13 | self.create_snake() 14 | self.head = self.segments[0] 15 | 16 | def create_snake(self): 17 | for position in STARTING_POSITIONS: 18 | self.add_segment(position) 19 | 20 | def add_segment(self, position): 21 | if position == (0,0): 22 | tim = Turtle(shape='triangle') 23 | else: 24 | tim = Turtle(shape='square') 25 | tim.color("white") 26 | tim.penup() 27 | tim.goto(position) 28 | self.segments.append(tim) 29 | 30 | def extend(self): 31 | # to add a segment in snake 32 | self.add_segment(self.segments[-1].position()) 33 | 34 | def move(self): 35 | for seg_num in range(len(self.segments) - 1, 0, -1): 36 | new_x = self.segments[seg_num - 1].xcor() 37 | new_y = self.segments[seg_num - 1].ycor() 38 | self.segments[seg_num].goto(new_x, new_y) 39 | 40 | self.head.forward(MOVE_DISTANCE) 41 | 42 | def up(self): 43 | if self.head.heading() != DOWN: 44 | self.head.setheading(UP) 45 | 46 | def down(self): 47 | if self.head.heading() != UP: 48 | self.head.setheading(DOWN) 49 | 50 | def left(self): 51 | if self.head.heading() != RIGHT: 52 | self.head.setheading(LEFT) 53 | 54 | def right(self): 55 | if self.head.heading() != LEFT: 56 | self.head.setheading(RIGHT) 57 | -------------------------------------------------------------------------------- /Day 22 Arcade Pong Game/Game Output.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 22 Arcade Pong Game/Game Output.PNG -------------------------------------------------------------------------------- /Day 22 Arcade Pong Game/README.md: -------------------------------------------------------------------------------- 1 | Arcade Pong Game in Python using Turtle Graphics 2 | -------------------------------------------------------------------------------- /Day 22 Arcade Pong Game/ball.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | 3 | class Ball(Turtle): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.shape("circle") 8 | self.color("white") 9 | self.penup() 10 | self.x_move = 10 11 | self.y_move = 10 12 | self.move_speed = 0.1 13 | 14 | def move(self): 15 | new_x = self.xcor() + self.x_move 16 | new_y = self.ycor() + self.y_move 17 | self.goto(new_x, new_y) 18 | 19 | def bounce_y(self): 20 | self.y_move *= -1 21 | 22 | def bounce_x(self): 23 | self.x_move *= -1 24 | self.move_speed *= 0.9 25 | 26 | def reset_position(self): 27 | self.goto(0, 0) 28 | self.move_speed = 0.1 29 | self.bounce_x() -------------------------------------------------------------------------------- /Day 22 Arcade Pong Game/main.py: -------------------------------------------------------------------------------- 1 | from turtle import 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.title("Arcade Pong Game") 9 | screen.bgcolor("black") 10 | screen.setup(height=600, width=800) 11 | # 0 is used in tracer to remove animation 12 | 13 | screen.tracer(0) 14 | 15 | r_paddle = Paddle((350, 0)) 16 | l_paddle = Paddle((-350, 0)) 17 | ball = Ball() 18 | scoreboard = Scoreboard() 19 | 20 | screen.listen() 21 | screen.onkey(r_paddle.go_up, "Up") 22 | screen.onkey(r_paddle.go_down, "Down") 23 | screen.onkey(l_paddle.go_up, "w") 24 | screen.onkey(l_paddle.go_down, "s") 25 | 26 | game_is_on = True 27 | while game_is_on: 28 | time.sleep(ball.move_speed) 29 | screen.update() 30 | ball.move() 31 | 32 | if(ball.ycor() > 280 or ball.ycor() < -280): 33 | # needs to bounce 34 | ball.bounce_y() 35 | 36 | # Detect Collinsion with paddle 37 | if (ball.distance(r_paddle) < 50 and ball.xcor() > 320) or (ball.distance(l_paddle) < 50 and ball.xcor() < -320): 38 | ball.bounce_x() 39 | 40 | # Detect R-Paddle Miss 41 | if ball.xcor() > 380: 42 | ball.reset_position() 43 | scoreboard.l_point() 44 | 45 | # Detect L-Paddle Miss 46 | if ball.xcor() < -380: 47 | ball.reset_position() 48 | scoreboard.r_point() 49 | 50 | 51 | 52 | 53 | 54 | screen.exitonclick() 55 | -------------------------------------------------------------------------------- /Day 22 Arcade Pong Game/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) 19 | 20 | 21 | -------------------------------------------------------------------------------- /Day 22 Arcade Pong Game/scoreboard.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle 2 | ALIGN = "center" 3 | FONT = ("Courier", 80, "normal") 4 | class Scoreboard(Turtle): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.color("white") 9 | self.penup() 10 | self.hideturtle() 11 | self.l_score = 0 12 | self.r_score = 0 13 | self.update_scoreboard() 14 | 15 | def update_scoreboard(self): 16 | self.clear() 17 | self.goto(-100, 200) 18 | self.write(self.l_score, align=ALIGN, font=FONT) 19 | self.goto(0, 200) 20 | self.write("-", align=ALIGN, font=FONT) 21 | self.goto(100, 200) 22 | self.write(self.r_score, align=ALIGN, font=FONT) 23 | 24 | def l_point(self): 25 | self.l_score += 1 26 | self.update_scoreboard() 27 | 28 | def r_point(self): 29 | self.r_score += 1 30 | self.update_scoreboard() 31 | -------------------------------------------------------------------------------- /Day 23 Turtle Crossing Game/Game Output.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 23 Turtle Crossing Game/Game Output.PNG -------------------------------------------------------------------------------- /Day 23 Turtle Crossing Game/README.md: -------------------------------------------------------------------------------- 1 | Turtle Crossing Game in Python 2 | -------------------------------------------------------------------------------- /Day 23 Turtle Crossing Game/car_manager.py: -------------------------------------------------------------------------------- 1 | COLORS = ["red", "orange", "yellow", "green", "blue", "purple"] 2 | STARTING_MOVE_DISTANCE = 5 3 | MOVE_INCREMENT = 10 4 | from turtle import Turtle 5 | import random 6 | 7 | class CarManager(Turtle): 8 | 9 | def __init__(self): 10 | super().__init__() 11 | self.all_cars = [] 12 | self.move_distance = STARTING_MOVE_DISTANCE 13 | 14 | def create_car(self): 15 | # random_chance = random.randint(1, 6) 16 | # if random_chance == 1: 17 | new_car = Turtle("square") 18 | new_car.penup() 19 | new_car.shapesize(stretch_len=2, stretch_wid= 1) 20 | new_car.color(random.choice(COLORS)) 21 | random_y = random.randint(-250, 250) 22 | new_car.goto(300, random_y) 23 | self.all_cars.append(new_car) 24 | 25 | def move_cars(self): 26 | for car in self.all_cars: 27 | self.hideturtle() 28 | car.backward(self.move_distance) 29 | 30 | def increase_car_speed(self): 31 | self.move_distance += MOVE_INCREMENT 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /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 | player = Player() 13 | car_manager = CarManager() 14 | 15 | screen.listen() 16 | screen.onkey(player.go_up, "Up") 17 | scoreboard = Scoreboard() 18 | car_no = 0 19 | game_is_on = True 20 | while game_is_on: 21 | time.sleep(0.1) 22 | 23 | if car_no % 6 == 0: 24 | car_manager.create_car() 25 | car_manager.move_cars() 26 | 27 | # Detect Collision 28 | for car in car_manager.all_cars: 29 | if car.distance(player) < 23: 30 | scoreboard.game_over() 31 | game_is_on = False 32 | 33 | # Detect if player has reached finish line 34 | if player.ycor() > 280: 35 | player.go_to_start() 36 | car_manager.increase_car_speed() 37 | scoreboard.update_scoreboard() 38 | 39 | car_no += 1 40 | screen.update() 41 | 42 | screen.exitonclick() 43 | -------------------------------------------------------------------------------- /Day 23 Turtle Crossing Game/player.py: -------------------------------------------------------------------------------- 1 | STARTING_POSITION = (0, -280) 2 | MOVE_DISTANCE = 10 3 | FINISH_LINE_Y = 280 4 | from turtle import Turtle 5 | 6 | class Player(Turtle): 7 | def __init__(self): 8 | super().__init__() 9 | self.shape("turtle") 10 | self.penup() 11 | self.setheading(90) 12 | self.go_to_start() 13 | 14 | def go_up(self): 15 | self.forward(MOVE_DISTANCE) 16 | 17 | def go_to_start(self): 18 | self.goto(STARTING_POSITION) 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Day 23 Turtle Crossing Game/scoreboard.py: -------------------------------------------------------------------------------- 1 | FONT = ("Courier", 24, "normal") 2 | ALIGN = "left" 3 | from turtle import Turtle 4 | 5 | class Scoreboard(Turtle): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | self.color("black") 10 | self.penup() 11 | self.hideturtle() 12 | self.level = 1 13 | self.update_scoreboard() 14 | 15 | def update_scoreboard(self): 16 | self.clear() 17 | self.goto(-250, 260) 18 | self.write(f"Level :{self.level}", align=ALIGN, font=FONT) 19 | self.level += 1 20 | 21 | def game_over(self): 22 | self.color("black") 23 | self.goto(0, 0) 24 | self.write(f"GAME OVER", align="center", font=FONT) 25 | 26 | 27 | -------------------------------------------------------------------------------- /Day 24 Mail Merge Project/Day 24 Mail Merge Project.py: -------------------------------------------------------------------------------- 1 | PLACEHOLDER = "[name]" 2 | 3 | 4 | with open("./Input/Names/invited_names.txt") as names_file: 5 | names = names_file.readlines() 6 | 7 | with open("./Input/Letters/starting_letter.txt") as letter_file: 8 | letter_contents = letter_file.read() 9 | for name in names: 10 | stripped_name = name.strip() 11 | new_letter = letter_contents.replace(PLACEHOLDER, stripped_name) 12 | with open(f"./Output/ReadyToSend/letter_for_{stripped_name}.txt", mode="w") as completed_letter: 13 | completed_letter.write(new_letter) 14 | 15 | -------------------------------------------------------------------------------- /Day 24 Mail Merge Project/Input/Letters/starting_letter.txt: -------------------------------------------------------------------------------- 1 | Dear [name], 2 | 3 | You are invited to my birthday this Saturday. 4 | 5 | Hope you can make it! 6 | 7 | Prachet 8 | -------------------------------------------------------------------------------- /Day 24 Mail Merge Project/Names/invited_names.txt: -------------------------------------------------------------------------------- 1 | Aang 2 | Zuko 3 | Appa 4 | Katara 5 | Sokka 6 | Momo 7 | Uncle Iroh 8 | Toph 9 | -------------------------------------------------------------------------------- /Day 24 Mail Merge Project/README.md: -------------------------------------------------------------------------------- 1 | Mail Merge Project in Python using Concepts of Directories and Local Files Path 2 | -------------------------------------------------------------------------------- /Day 25 US State 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 US State Game/README.md: -------------------------------------------------------------------------------- 1 | US State Game in Python 2 | -------------------------------------------------------------------------------- /Day 25 US State Game/US State Game Output.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 25 US State Game/US State Game Output.PNG -------------------------------------------------------------------------------- /Day 25 US State Game/blank_states_img.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 25 US State Game/blank_states_img.gif -------------------------------------------------------------------------------- /Day 25 US State Game/main.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import pandas 3 | 4 | screen = turtle.Screen() 5 | screen.title("US States Game") 6 | 7 | image = "blank_states_img.gif" 8 | screen.addshape(image) 9 | 10 | turtle.shape(image) 11 | data = pandas.read_csv("50_states.csv") 12 | states = data.state.tolist() 13 | x_cor = data['x'].tolist() 14 | y_cor = data['y'].tolist() 15 | 16 | game_on = True 17 | count = 0 18 | correct_guess = [] 19 | 20 | while len(correct_guess) < 50: 21 | answer = screen.textinput(title=f"{count}/50 Guess the State", prompt="Enter State's Name") 22 | answer_state = answer.title() 23 | if answer_state == 'Exit': 24 | break 25 | if answer_state in states: 26 | correct_guess.append(answer_state) 27 | count += 1 28 | name = turtle.Turtle() 29 | name.hideturtle() 30 | name.penup() 31 | x_dist = x_cor[states.index(answer_state)] 32 | y_dist = y_cor[states.index(answer_state)] 33 | name.goto(x_dist, y_dist) 34 | name.write(answer_state) 35 | 36 | 37 | states_to_learn = [] 38 | for state in states: 39 | if state not in correct_guess: 40 | states_to_learn.append(state) 41 | 42 | print(states_to_learn) 43 | final = pandas.DataFrame(states_to_learn) 44 | final.to_csv("states_to_learn") -------------------------------------------------------------------------------- /Day 25 US State Game/states_to_learn: -------------------------------------------------------------------------------- 1 | ,0 2 | 0,Arkansas 3 | 1,Colorado 4 | 2,Connecticut 5 | 3,Delaware 6 | 4,Florida 7 | 5,Georgia 8 | 6,Idaho 9 | 7,Iowa 10 | 8,Kansas 11 | 9,Kentucky 12 | 10,Louisiana 13 | 11,Maine 14 | 12,Maryland 15 | 13,Massachusetts 16 | 14,Michigan 17 | 15,Missouri 18 | 16,Nebraska 19 | 17,New Hampshire 20 | 18,New Mexico 21 | 19,North Carolina 22 | 20,Oklahoma 23 | 21,Oregon 24 | 22,South Carolina 25 | 23,Tennessee 26 | 24,Utah 27 | 25,Vermont 28 | 26,Washington 29 | 27,West Virginia 30 | 28,Wyoming 31 | -------------------------------------------------------------------------------- /Day 26 NATO Alphabet Project/Output.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 26 NATO Alphabet Project/Output.PNG -------------------------------------------------------------------------------- /Day 26 NATO Alphabet Project/README.md: -------------------------------------------------------------------------------- 1 | NATO Alphabet Project in Python 2 | -------------------------------------------------------------------------------- /Day 26 NATO Alphabet Project/main.py: -------------------------------------------------------------------------------- 1 | import pandas 2 | 3 | 4 | #TODO 1. Create a dictionary in this format: 5 | # {"A": "Alfa", "B": "Bravo"} 6 | data = pandas.read_csv("nato_phonetic_alphabet.csv") 7 | # data_frame = pandas.DataFrame(data) 8 | dict = {row.letter: row.code for (index, row) in data.iterrows()} 9 | #TODO 2. Create a list of the phonetic code words from a word that the user inputs. 10 | 11 | word = input("Enter a word: ") 12 | new_word = word.upper() 13 | print(new_word) 14 | phonetic_list = [dict[letter] for letter in new_word] 15 | print(phonetic_list) -------------------------------------------------------------------------------- /Day 26 NATO Alphabet Project/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 27 Km to Miles Converter GUI Project/README.md: -------------------------------------------------------------------------------- 1 | Km to Miles Converter Project in Python Tkinter 2 | -------------------------------------------------------------------------------- /Day 27 Km to Miles Converter GUI Project/main.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | 3 | def miles_to_km(): 4 | km = km_input.get() 5 | miles = float(km)*0.6214 6 | mile_result.config(text=f"{miles}") 7 | 8 | window = Tk() 9 | window.title("Miles to Kilometre Converter") 10 | window.configure(padx=20, pady=20) 11 | 12 | km_input = Entry(width=5) 13 | km_input.grid(column=1, row=0) 14 | 15 | kilometer_label = Label(text="Km") 16 | kilometer_label.grid(column=2, row=0) 17 | 18 | is_equal_label = Label(text="is equal to") 19 | is_equal_label.grid(column=0,row=1) 20 | 21 | mile_result = Label(text="0") 22 | mile_result.grid(column=1, row=1) 23 | 24 | mile_label = Label(text="Miles") 25 | mile_label.grid(column=2, row=1) 26 | 27 | calculate_button = Button(text="Calculate", command = miles_to_km) 28 | calculate_button.grid(column=1,row=2) 29 | 30 | window.mainloop() 31 | 32 | -------------------------------------------------------------------------------- /Day 28 Pomodoro Timer/Output.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 28 Pomodoro Timer/Output.PNG -------------------------------------------------------------------------------- /Day 28 Pomodoro Timer/README.md: -------------------------------------------------------------------------------- 1 | Pomodoro Timer Project in Python Tkinter 2 | -------------------------------------------------------------------------------- /Day 28 Pomodoro Timer/main.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | import math 3 | # ---------------------------- CONSTANTS ------------------------------- # 4 | PINK = "#e2979c" 5 | RED = "#e7305b" 6 | GREEN = "#9bdeac" 7 | YELLOW = "#f7f5dd" 8 | FONT_NAME = "Courier" 9 | WORK_MIN = 25 10 | SHORT_BREAK_MIN = 5 11 | LONG_BREAK_MIN = 20 12 | reps = 0 13 | timer = None 14 | 15 | # ---------------------------- TIMER RESET ------------------------------- # 16 | 17 | def reset_timer(): 18 | window.after_cancel(timer) 19 | title_label.config(text="Timer") 20 | canvas.itemconfig(timer_text, text='00:00') 21 | check_marks.config(text="") 22 | global reps 23 | reps = 0 24 | 25 | # ---------------------------- TIMER MECHANISM ------------------------------- # 26 | 27 | def start_timer(): 28 | global reps 29 | reps += 1 30 | work_sec = WORK_MIN * 60 31 | short_break_secs = SHORT_BREAK_MIN * 60 32 | long_break_secs = LONG_BREAK_MIN * 60 33 | if reps % 8 == 0: 34 | count_down(long_break_secs) 35 | title_label.configure(text="Break", fg=RED) 36 | elif reps % 2 == 0: 37 | count_down(short_break_secs) 38 | title_label.configure(text="Break", fg=PINK) 39 | else: 40 | count_down(work_sec) 41 | title_label.configure(text="Work", fg=GREEN) 42 | 43 | 44 | # ---------------------------- COUNTDOWN MECHANISM ------------------------------- # 45 | def count_down(count): 46 | count_min = math.floor(count / 60) 47 | count_sec = count % 60 48 | if count_sec < 10: 49 | count_sec = f"0{count_sec}" 50 | canvas.itemconfig(timer_text, text=f"{count_min}:{count_sec}") 51 | if count > 0: 52 | global timer 53 | timer = window.after(1000, count_down, count - 1) 54 | else: 55 | start_timer() 56 | marks = "" 57 | for _ in range(0, math.floor(reps/2)): 58 | marks += "✔" 59 | check_marks.config(text=marks) 60 | 61 | # ---------------------------- UI SETUP ------------------------------- # 62 | 63 | window = Tk() 64 | window.title("Pomodoro Timer") 65 | window.configure(padx=100, pady=50, bg=YELLOW) 66 | 67 | 68 | canvas = Canvas(width=200, height=224, bg=YELLOW, highlightthickness=0) 69 | tomato_img = PhotoImage(file="tomato.png") 70 | canvas.create_image(100, 112, image=tomato_img) 71 | canvas.grid(column=2, row=2) 72 | timer_text = canvas.create_text(101, 130, text="00:00", fill="white", font=(FONT_NAME, 34, "bold")) 73 | 74 | title_label = Label(text="Timer", bg=YELLOW, fg=GREEN, font=(FONT_NAME, 50)) 75 | title_label.grid(column=2, row=1) 76 | 77 | start_button = Button(text="Start", command=start_timer) 78 | start_button.grid(column=1, row=3) 79 | 80 | reset_button = Button(text="Reset", command = reset_timer) 81 | reset_button.grid(column=3, row=3) 82 | 83 | check_marks = Label(bg=YELLOW, fg=GREEN, font=(FONT_NAME, 25, "bold")) 84 | check_marks.grid(column=2, row=4) 85 | 86 | window.mainloop() 87 | -------------------------------------------------------------------------------- /Day 29 Password Manager Application/README.md: -------------------------------------------------------------------------------- 1 | Password Manager Application In Python 2 | -------------------------------------------------------------------------------- /Day 29 Password Manager Application/main.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | from tkinter import messagebox 3 | # ---------------------------- PASSWORD GENERATOR ------------------------------- # 4 | #Password Generator Project 5 | import random 6 | def password_generator(): 7 | letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] 8 | numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] 9 | symbols = ['!', '#', '$', '%', '&', '*', '@'] 10 | 11 | password_letters = [random.choice(letters) for _ in range(random.randint(5, 6))] 12 | password_symbols = [random.choice(symbols) for _ in range(random.randint(2, 3))] 13 | password_numbers = [random.choice(numbers) for _ in range(random.randint(2, 3))] 14 | 15 | password_list = password_letters + password_symbols + password_numbers 16 | random.shuffle(password_list) 17 | 18 | password = "".join(password_list) 19 | password_entry.insert(0, password) 20 | 21 | # ---------------------------- SAVE PASSWORD ------------------------------- # 22 | 23 | def save(): 24 | website = website_entry.get() 25 | email = email_entry.get() 26 | password = password_entry.get() 27 | 28 | if len(website)==0 or len(password) == 0: 29 | messagebox.showinfo(title="Warning",message="Please Don't leave any fields empty") 30 | else: 31 | is_okay = messagebox.askokcancel(title=f"{website}", message=f"These are the details entered:\nEmail:{email}" 32 | f"\nPassword:{password}\nIs it okay to save?") 33 | 34 | if is_okay: 35 | with open("data.txt", "a") as data: 36 | data.write(f"{website} | {email} | {password}\n") 37 | # delete 0 to END is used to delete the entry once it is added once ti type again 38 | website_entry.delete(0,END) 39 | password_entry.delete(0, END) 40 | 41 | # ---------------------------- UI SETUP ------------------------------- # 42 | window = Tk() 43 | window.title("Password Manager") 44 | window.config(padx=30, pady=20,bg='Light Yellow') 45 | 46 | canvas = Canvas(width=200, height=200,bg="Light Yellow", highlightthickness=0) 47 | logo_img = PhotoImage(file="logo.png") 48 | canvas.create_image(50, 100, image=logo_img) 49 | canvas.grid(column=1, row=0, columnspan=2) 50 | 51 | website_label = Label(text="Website:", bg="Light Yellow") 52 | website_label.grid(column=0, row=1) 53 | 54 | email_label = Label(text="Email/Username:", bg="Light Yellow") 55 | email_label.grid(column=0, row=2) 56 | 57 | password_label = Label(text="Password",bg="Light Yellow") 58 | password_label.grid(column=0, row=3) 59 | 60 | website_entry = Entry(width=41) 61 | website_entry.grid(column=1, row=1,columnspan=2) 62 | 63 | email_entry = Entry(width=41) 64 | email_entry.grid(column=1, row=2,columnspan=2) 65 | email_entry.insert(0, "dummy_email@gmail.com") 66 | 67 | password_entry = Entry(width=21) 68 | password_entry.grid(column=1, row=3) 69 | 70 | generate_password = Button(text="Generate Password", command = password_generator, width=14) 71 | generate_password.grid(column=2, row=3) 72 | 73 | add_button = Button(text="Add",width=38,bg="white", command=save) 74 | add_button.grid(column=1, row=4, columnspan=2) 75 | 76 | window.mainloop() 77 | -------------------------------------------------------------------------------- /Day 2: Tip Calculator.py: -------------------------------------------------------------------------------- 1 | #Link to Tip Calculator Project : 2 | 3 | #https://replit.com/@PrachetShah/tip-calculator?embed=1&output=1#main.py 4 | 5 | #Code: 6 | print("Welcome to the Tip Calculator") 7 | bill = float(input("What was the total bill :$")) 8 | tip_percent = int(input("What percentage tip would you like to give 10,12, or 15 :")) 9 | total_bill = bill + bill*tip_percent/100 10 | people = int(input("How many people to split the bill? ")) 11 | bill_of_person = round(total_bill/people, 2) 12 | print("Each person should pay ${:.2f}".format(bill_of_person)) 13 | -------------------------------------------------------------------------------- /Day 30 Exception Handling/README.md: -------------------------------------------------------------------------------- 1 | Today i learned about exception handling in Python and saving data in JSON Files.
Also Updated Password Manager App and made UI more smooth and User Friendly 2 | -------------------------------------------------------------------------------- /Day 30 Exception Handling/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 30 Exception Handling/logo.png -------------------------------------------------------------------------------- /Day 31 Flash Card Application/README.md: -------------------------------------------------------------------------------- 1 | Flash Card Application to learn simple French Words 2 | -------------------------------------------------------------------------------- /Day 31 Flash Card Application/data/french_words.csv: -------------------------------------------------------------------------------- 1 | French,English 2 | partie,part 3 | histoire,history 4 | chercher,search 5 | seulement,only 6 | police,police 7 | pensais,thought 8 | aide,help 9 | demande,request 10 | genre,kind 11 | mois,month 12 | frère,brother 13 | laisser,let 14 | car,because 15 | mettre,to put 16 | aucun,no 17 | laisse,leash 18 | eux,them 19 | ville,city 20 | chaque,each 21 | parlé,speak 22 | arrivé,come 23 | devrait,should 24 | bébé,baby 25 | longtemps,long time 26 | heures,hours 27 | vont,will 28 | pendant,while 29 | revoir,meet again 30 | aucune,any 31 | place,square 32 | parle,speak 33 | compris,understood 34 | savais,knew 35 | étaient,were 36 | attention,Warning 37 | voici,here is 38 | pourrais,could 39 | affaire,case 40 | donner,give 41 | type,type 42 | leurs,their 43 | donné,given 44 | train,train 45 | corps,body 46 | endroit,place 47 | yeux,eyes 48 | façon,way 49 | écoute,listen 50 | dont,whose 51 | trouve,find 52 | premier,first 53 | perdu,lost 54 | main,hand 55 | première,first 56 | côté,side 57 | pouvoir,power 58 | vieux,old 59 | sois,be 60 | tiens,here 61 | matin,morning 62 | tellement,so much 63 | enfant,child 64 | point,point 65 | venu,came 66 | suite,after 67 | pardon,sorry 68 | venez,come 69 | devant,in front of 70 | vers,towards 71 | minutes,minutes 72 | demandé,request 73 | chambre,bedroom 74 | mis,placed 75 | belle,beautiful 76 | droit,law 77 | aimerais,would like to 78 | aujourd'hui,today 79 | mari,husband 80 | cause,cause 81 | enfin,finally 82 | espère,hope 83 | eau,water 84 | attendez,Wait 85 | parti,left 86 | nouvelle,new 87 | boulot,job 88 | arrêter,Stop 89 | dirait,would say 90 | terre,Earth 91 | compte,account 92 | donne,given 93 | loin,far 94 | fin,end 95 | croire,believe 96 | chérie,sweetheart 97 | gros,large 98 | plutôt,rather 99 | aura,will have 100 | filles,girls 101 | jouer,to play 102 | bureau,office -------------------------------------------------------------------------------- /Day 31 Flash Card Application/images/card_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 31 Flash Card Application/images/card_back.png -------------------------------------------------------------------------------- /Day 31 Flash Card Application/images/card_front.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 31 Flash Card Application/images/card_front.png -------------------------------------------------------------------------------- /Day 31 Flash Card Application/images/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 31 Flash Card Application/images/right.png -------------------------------------------------------------------------------- /Day 31 Flash Card Application/images/wrong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 31 Flash Card Application/images/wrong.png -------------------------------------------------------------------------------- /Day 31 Flash Card Application/main.py: -------------------------------------------------------------------------------- 1 | BACKGROUND_COLOR = "#B1DDC6" 2 | from tkinter import * 3 | import pandas 4 | import random 5 | 6 | current_card = {} 7 | to_learn = {} 8 | try: 9 | data = pandas.read_csv("data/words_to_learn.csv") 10 | except FileNotFoundError: 11 | original_data = pandas.read_csv("data/french_words.csv") 12 | to_learn = original_data.to_dict(orient="records") 13 | else: 14 | to_learn = data.to_dict(orient="records") 15 | 16 | 17 | def next_card(): 18 | global current_card,flip_timer 19 | window.after_cancel(flip_timer) 20 | current_card = random.choice(to_learn) 21 | canvas.itemconfig(card_title, text="French", fill="black") 22 | canvas.itemconfig(card_word, text=current_card["French"], fill="black") 23 | canvas.itemconfig(card_background, image=card_front_img) 24 | flip_timer = window.after(3000, func=flip_card) 25 | 26 | def flip_card(): 27 | canvas.itemconfig(card_title, text="English", fill="white") 28 | canvas.itemconfig(card_word, text=current_card["English"], fill="white") 29 | canvas.itemconfig(card_background, image=card_back_img) 30 | 31 | def is_known(): 32 | to_learn.remove(current_card) 33 | data = pandas.DataFrame(to_learn) 34 | #index=False does not add number like 1,2,3, to the rows 35 | data.to_csv("data/words_to_learn.csv", index=False) 36 | next_card() 37 | pass 38 | 39 | window = Tk() 40 | window.title("Flashy") 41 | window.config(padx=50, pady=50, bg=BACKGROUND_COLOR) 42 | flip_timer = window.after(3000, func=flip_card) 43 | 44 | 45 | canvas = Canvas(width=800, height=526) 46 | card_front_img = PhotoImage(file="images/card_front.png") 47 | card_back_img = PhotoImage(file="images/card_back.png") 48 | card_background = canvas.create_image(400, 263, image=card_front_img) 49 | 50 | 51 | 52 | card_title = canvas.create_text(400, 150, text="",font=("Ariel", 40, "italic")) 53 | card_word = canvas.create_text(400, 263, text="",font=("Ariel", 60, "bold")) 54 | 55 | canvas.config(bg=BACKGROUND_COLOR, highlightthickness=0) 56 | canvas.grid(row=0, column=0, columnspan=2) 57 | 58 | cross_image = PhotoImage(file='images/wrong.png') 59 | unknown_button = Button(image=cross_image, highlightthickness=0, command=next_card) 60 | unknown_button.grid(row=1,column=0) 61 | 62 | check_image = PhotoImage(file='images/right.png') 63 | known_button = Button(image=check_image, highlightthickness=0, command=is_known) 64 | known_button.grid(row=1,column=1) 65 | 66 | next_card() 67 | 68 | window.mainloop() 69 | 70 | -------------------------------------------------------------------------------- /Day 32 Email Automation using SMTP/README.md: -------------------------------------------------------------------------------- 1 | Email Automation in Python using SMTP and datetime modules 2 | -------------------------------------------------------------------------------- /Day 32 Email Automation using SMTP/birthdays.csv: -------------------------------------------------------------------------------- 1 | name,email,year,month,day 2 | me,testpython_days@yahoo.com,2020,6,24 -------------------------------------------------------------------------------- /Day 32 Email Automation using SMTP/letter_templates/letter_1.txt: -------------------------------------------------------------------------------- 1 | Dear [NAME], 2 | 3 | Happy birthday! 4 | 5 | All the best for the year! 6 | 7 | Prachet -------------------------------------------------------------------------------- /Day 32 Email Automation using SMTP/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 | Prachet -------------------------------------------------------------------------------- /Day 32 Email Automation using SMTP/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 | Prachet -------------------------------------------------------------------------------- /Day 32 Email Automation using SMTP/main.py: -------------------------------------------------------------------------------- 1 | import datetime as dt 2 | import pandas as pd 3 | import random 4 | import smtplib 5 | 6 | my_email = ENTER EMAIL 7 | password = ENTER PASSWORD 8 | 9 | day = dt.datetime.now() 10 | today_month = day.month 11 | today_day = day.day 12 | today = (today_month, today_day) 13 | 14 | 15 | data = pd.read_csv("birthdays.csv") 16 | birthdays_dict = {(data_row['month'], data_row['day']) : data_row for (index, data_row) in data.iterrows()} 17 | 18 | if today in birthdays_dict: 19 | birthday_person = birthdays_dict[today] 20 | file_path = f"letter_templates/letter_{random.randint(1,3)}.txt" 21 | with open(file_path) as letter_file: 22 | contents = letter_file.read() 23 | contents = contents.replace('[NAME]', birthday_person['name']) 24 | with smtplib.SMTP(host="smtp.gmail.com", port=587) as connection: 25 | # This line makes the connection secure by encrypting the message 26 | connection.starttls() 27 | connection.login(user=my_email, password=password) 28 | connection.sendmail(from_addr=my_email, 29 | to_addrs=birthday_person['email'], 30 | msg=f"Subject:Happy Birthday!!\n\n{contents}") 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Day 33 Working with APIs/ISS_TRACKER.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from datetime import datetime 3 | import smtplib 4 | import time 5 | 6 | # Mumbai Latitude and Longitude 7 | MY_LAT = 19.101803 8 | MY_LONG = 72.890353 9 | EMAIL = YOUR_EMAIL 10 | PASS = PASSWORD 11 | 12 | def is_iss_overhead(): 13 | response = requests.get(url="http://api.open-notify.org/iss-now.json") 14 | response.raise_for_status() 15 | data = response.json() 16 | 17 | iss_latitude = float(data["iss_position"]["latitude"]) 18 | iss_longitude = float(data["iss_position"]["longitude"]) 19 | 20 | # Your position is within +5 or -5 degrees of the ISS position. 21 | if (MY_LAT - 5 <= iss_latitude <= MY_LAT + 5) and (MY_LONG - 5 <= iss_longitude <= MY_LONG + 5): 22 | return True 23 | 24 | def is_night(): 25 | parameters = { 26 | "lat": MY_LAT, 27 | "lng": MY_LONG, 28 | "formatted": 0, 29 | } 30 | 31 | response = requests.get("https://api.sunrise-sunset.org/json", params=parameters) 32 | response.raise_for_status() 33 | data = response.json() 34 | sunrise = int(data["results"]["sunrise"].split("T")[1].split(":")[0]) 35 | sunset = int(data["results"]["sunset"].split("T")[1].split(":")[0]) 36 | 37 | time_now = datetime.now().hour 38 | if time_now >= sunset or time_now <= sunrise: 39 | return True 40 | 41 | while True: 42 | time.sleep(60) 43 | if is_iss_overhead() and is_night(): 44 | # For gmail it is smtp.gmail.com it is different for diff servers 45 | # smtplib.SMTP("smtp.gmail.com"), we use port if only host does not work 46 | with smtplib.SMTP(host="smtp.gmail.com", port=587) as connection: 47 | 48 | # This line makes the connection secure by encrypting the message 49 | connection.starttls() 50 | connection.login(user=EMAIL, password=PASS) 51 | connection.sendmail(from_addr=EMAIL, 52 | to_addrs="testpython_days@yahoo.com", 53 | msg="Subject:Look Up\n\nThe ISS is above you in the sky") 54 | # U can use "with" keyword here as well to close the file once used 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Day 33 Working with APIs/README.md: -------------------------------------------------------------------------------- 1 | Some Projects made for learning how to work with APIs 2 | -------------------------------------------------------------------------------- /Day 33 Working with APIs/Sunrise&Sunset.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from datetime import datetime 3 | # Need to create parameters for this API Which should match its parameters 4 | MY_LAT = 19.075983 5 | MY_LNG = 72.877655 6 | 7 | parameters = { 8 | "lat":MY_LAT, 9 | "lng":MY_LNG, 10 | "formatted":0 11 | } 12 | 13 | resonse = requests.get(url="https://api.sunrise-sunset.org/json", params=parameters) 14 | resonse.raise_for_status() 15 | data = resonse.json() 16 | sunrise = data["results"]["sunrise"].split("T")[1].split(":")[0] 17 | sunset = data["results"]["sunset"].split("T")[1].split(":")[0] 18 | print(sunrise) 19 | print(sunset) 20 | 21 | time_now = datetime.now() 22 | # print(time_now) 23 | -------------------------------------------------------------------------------- /Day 34 Quizzler App with OpenTrivia API/Output.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 34 Quizzler App with OpenTrivia API/Output.PNG -------------------------------------------------------------------------------- /Day 34 Quizzler App with OpenTrivia API/README.md: -------------------------------------------------------------------------------- 1 | Quizzler GUI App using Python and data from OpenTrivia API 2 | -------------------------------------------------------------------------------- /Day 34 Quizzler App with OpenTrivia API/data.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | parameters = { 4 | "amount": 10, 5 | "type": "boolean", 6 | } 7 | response = requests.get(url="https://opentdb.com/api.php", params=parameters) 8 | response.raise_for_status() 9 | question_data = response.json()["results"] 10 | -------------------------------------------------------------------------------- /Day 34 Quizzler App with OpenTrivia API/main.py: -------------------------------------------------------------------------------- 1 | from question_model import Question 2 | from data import question_data 3 | from quiz_brain import QuizBrain 4 | from ui import QuizInterface 5 | 6 | question_bank = [] 7 | for question in question_data: 8 | question_text = question["question"] 9 | question_answer = question["correct_answer"] 10 | new_question = Question(question_text, question_answer) 11 | question_bank.append(new_question) 12 | 13 | 14 | quiz = QuizBrain(question_bank) 15 | quiz_ui = QuizInterface(quiz) 16 | 17 | # while quiz.still_has_questions(): 18 | # quiz.next_question() 19 | 20 | print("You've completed the quiz") 21 | print(f"Your final score was: {quiz.score}/{quiz.question_number}") 22 | -------------------------------------------------------------------------------- /Day 34 Quizzler App with OpenTrivia API/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 App with OpenTrivia API/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 = self.current_question.text 18 | return f"Q.{self.question_number}: {html.unescape(q_text)} (True/False): " 19 | # user_answer = input(f"Q.{self.question_number}: {html.unescape(q_text)} (True/False): ") 20 | # self.check_answer(user_answer) 21 | 22 | def check_answer(self, user_answer): 23 | correct_answer = self.current_question.answer 24 | if user_answer.lower() == correct_answer.lower(): 25 | self.score += 1 26 | return True 27 | else: 28 | return False 29 | -------------------------------------------------------------------------------- /Day 34 Quizzler App with OpenTrivia API/ui.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | THEME_COLOR = "#375362" 3 | from quiz_brain import QuizBrain 4 | 5 | class QuizInterface: 6 | # You can add a datatype to quizbrain to get code recommnedations 7 | def __init__(self, quiz_brain: QuizBrain): 8 | self.quiz = quiz_brain 9 | self.window = Tk() 10 | self.window.title("Quizzler") 11 | self.window.config(bg=THEME_COLOR, padx=20, pady=20) 12 | 13 | self.score_label = Label(text="Score: 0", fg="white", bg=THEME_COLOR) 14 | self.score_label.grid(row=0,column=1) 15 | 16 | self.canvas = Canvas(width=300, height=250, bg="white") 17 | self.question_text = self.canvas.create_text(150, 125, 18 | width=280, 19 | text="Some Question Text", 20 | fill=THEME_COLOR, 21 | font=("arial", 18, "italic")) 22 | self.canvas.grid(pady=50, row=1, column=0, columnspan=2) 23 | 24 | # We dont add self.img here cause we dont want to use it elsewhere in the class 25 | true_image = PhotoImage(file="images/true.png") 26 | false_image = PhotoImage(file="images/false.png") 27 | 28 | self.true_button = Button(image=true_image, highlightthickness=0, command=self.true_pressed) 29 | self.true_button.grid(row=2,column=0) 30 | 31 | self.false_button = Button(image=false_image, highlightthickness=0, command=self.false_pressed) 32 | self.false_button.grid(row=2, column=1) 33 | self.get_next_question() 34 | 35 | self.window.mainloop() 36 | 37 | def get_next_question(self): 38 | self.canvas.config(bg="white") 39 | if self.quiz.still_has_questions(): 40 | self.score_label.config(text=f"Score: {self.quiz.score}") 41 | q_text = self.quiz.next_question() 42 | self.canvas.itemconfig(self.question_text, text=q_text) 43 | else: 44 | self.canvas.itemconfig(self.question_text, text="You've reached the end of Quiz.") 45 | self.true_button.config(state="disabled") 46 | self.false_button.config(state="disabled") 47 | def true_pressed(self): 48 | self.give_feedback(self.quiz.check_answer("True")) 49 | 50 | def false_pressed(self): 51 | self.give_feedback(self.quiz.check_answer("False")) 52 | 53 | def give_feedback(self, is_right): 54 | if is_right: 55 | self.canvas.config(bg="green") 56 | else: 57 | self.canvas.config(bg='red') 58 | 59 | self.window.after(1000, self.get_next_question) 60 | 61 | 62 | -------------------------------------------------------------------------------- /Day 35 Rain Alert App with Twilio and OpenWeather API/README.md: -------------------------------------------------------------------------------- 1 | Rain Alert App with Twilio and OpenWeather API 2 | -------------------------------------------------------------------------------- /Day 35 Rain Alert App with Twilio and OpenWeather API/main.py: -------------------------------------------------------------------------------- 1 | #Note! For the code to work you need to replace all the placeholders with 2 | #Your own details. e.g. account_sid, lat/lon, from/to phone numbers. 3 | 4 | import requests 5 | import os 6 | from twilio.rest import Client 7 | from twilio.http.http_client import TwilioHttpClient 8 | 9 | OWM_Endpoint = "https://api.openweathermap.org/data/2.5/onecall" 10 | api_key = os.environ.get("OWM_API_KEY") 11 | account_sid = "YOUR ACCOUNT SID" 12 | auth_token = os.environ.get("AUTH_TOKEN") 13 | 14 | weather_params = { 15 | "lat": "YOUR LATITUDE", 16 | "lon": "YOUR LONGITUDE", 17 | "appid": api_key, 18 | "exclude": "current,minutely,daily" 19 | } 20 | 21 | response = requests.get(OWM_Endpoint, params=weather_params) 22 | response.raise_for_status() 23 | weather_data = response.json() 24 | weather_slice = weather_data["hourly"][:12] 25 | 26 | will_rain = False 27 | 28 | for hour_data in weather_slice: 29 | condition_code = hour_data["weather"][0]["id"] 30 | if int(condition_code) < 700: 31 | will_rain = True 32 | 33 | if will_rain: 34 | proxy_client = TwilioHttpClient() 35 | proxy_client.session.proxies = {'https': os.environ['https_proxy']} 36 | 37 | client = Client(account_sid, auth_token, http_client=proxy_client) 38 | message = client.messages \ 39 | .create( 40 | body="It's going to rain today. Remember to bring an ☔️", 41 | from_="YOUR TWILIO VIRTUAL NUMBER", 42 | to="YOUR TWILIO VERIFIED REAL NUMBER" 43 | ) 44 | print(message.status) 45 | -------------------------------------------------------------------------------- /Day 36 Tesla Stock News Monitoring Project/Message Output on Phone.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 36 Tesla Stock News Monitoring Project/Message Output on Phone.jpg -------------------------------------------------------------------------------- /Day 36 Tesla Stock News Monitoring Project/README.md: -------------------------------------------------------------------------------- 1 | Stock News Monitoring Project using News API, AlphaAdvanage API and Sending Alerts on Phone by SMS using Twilio API 2 | -------------------------------------------------------------------------------- /Day 36 Tesla Stock News Monitoring Project/main.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from twilio.rest import Client 3 | 4 | VIRTUAL_TWILIO_NUMBER = "your virtual twilio number" 5 | VERIFIED_NUMBER = "your own phone number verified with Twilio" 6 | 7 | STOCK_NAME = "TSLA" 8 | COMPANY_NAME = "Tesla Inc" 9 | 10 | STOCK_ENDPOINT = "https://www.alphavantage.co/query" 11 | NEWS_ENDPOINT = "https://newsapi.org/v2/everything" 12 | 13 | STOCK_API_KEY = "YOUR OWN API KEY FROM ALPHAVANTAGE" 14 | NEWS_API_KEY = "YOUR OWN API KEY FROM NEWSAPI" 15 | TWILIO_SID = "YOUR TWILIO ACCOUNT SID" 16 | TWILIO_AUTH_TOKEN = "YOUR TWILIO AUTH TOKEN" 17 | 18 | #Get yesterday's closing stock price 19 | stock_params = { 20 | "function": "TIME_SERIES_DAILY", 21 | "symbol": STOCK_NAME, 22 | "apikey": STOCK_API_KEY, 23 | } 24 | 25 | response = requests.get(STOCK_ENDPOINT, params=stock_params) 26 | data = response.json()["Time Series (Daily)"] 27 | data_list = [value for (key, value) in data.items()] 28 | yesterday_data = data_list[0] 29 | yesterday_closing_price = yesterday_data["4. close"] 30 | print(yesterday_closing_price) 31 | 32 | #Get the day before yesterday's closing stock price 33 | day_before_yesterday_data = data_list[1] 34 | day_before_yesterday_closing_price = day_before_yesterday_data["4. close"] 35 | print(day_before_yesterday_closing_price) 36 | 37 | #Find the positive difference between 1 and 2. e.g. 40 - 20 = -20, but the positive difference is 20. 38 | difference = float(yesterday_closing_price) - float(day_before_yesterday_closing_price) 39 | up_down = None 40 | if difference > 0: 41 | up_down = "🔺" 42 | else: 43 | up_down = "🔻" 44 | 45 | #Work out the percentage difference in price between closing price yesterday and closing price the day before yesterday. 46 | diff_percent = round((difference / float(yesterday_closing_price)) * 100) 47 | print(diff_percent) 48 | 49 | if abs(diff_percent) > 1: 50 | news_params = { 51 | "apiKey": NEWS_API_KEY, 52 | "qInTitle": COMPANY_NAME, 53 | } 54 | 55 | news_response = requests.get(NEWS_ENDPOINT, params=news_params) 56 | articles = news_response.json()["articles"] 57 | 58 | #Use Python slice operator to create a list that contains the first 3 articles. Hint: https://stackoverflow.com/questions/509211/understanding-slice-notation 59 | three_articles = articles[:3] 60 | print(three_articles) 61 | 62 | #Create a new list of the first 3 article's headline and description using list comprehension. 63 | formatted_articles = [f"{STOCK_NAME}: {up_down}{diff_percent}%\nHeadline: {article['title']}. \nBrief: {article['description']}" for article in three_articles] 64 | print(formatted_articles) 65 | #Send each article as a separate message via Twilio. 66 | client = Client(TWILIO_SID, TWILIO_AUTH_TOKEN) 67 | for article in formatted_articles: 68 | message = client.messages.create( 69 | body=article, 70 | from_=VIRTUAL_TWILIO_NUMBER, 71 | to=VERIFIED_NUMBER 72 | ) 73 | -------------------------------------------------------------------------------- /Day 37 Habit Tracker using Pixela API/Output.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 37 Habit Tracker using Pixela API/Output.PNG -------------------------------------------------------------------------------- /Day 37 Habit Tracker using Pixela API/README.md: -------------------------------------------------------------------------------- 1 | Today I made a basic Habit Tracker by learning HTTP POST, PUT & DELETE 2 | using Pixela API 3 | -------------------------------------------------------------------------------- /Day 37 Habit Tracker using Pixela API/main.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from datetime import datetime 3 | 4 | pixela_endpoint = "https://pixe.la/v1/users" 5 | TOKEN = "fuiw47yhhdhv" 6 | USERNAME = Create A Username 7 | GRAPH_ID = "graph2" 8 | 9 | # Creating a User 10 | user_params = { 11 | # Add random token 12 | "token": TOKEN, 13 | "username": USERNAME , 14 | "agreeTermsOfService": "yes", 15 | "notMinor": "yes" 16 | } 17 | 18 | # # POST Takes json as parameters 19 | # response = requests.post(url=pixela_endpoint,json=user_params) 20 | # print(response.text) 21 | 22 | # Creating a Graph 23 | graph_endpoint = f"{pixela_endpoint}/{USERNAME}/graphs" 24 | 25 | graph_config = { 26 | "id": GRAPH_ID, 27 | "name": "Walking Graph", 28 | "unit" : "km", 29 | "type": "float", 30 | "color": "ajisai" 31 | } 32 | 33 | headers = { 34 | "X-USER-TOKEN": TOKEN 35 | } 36 | # response = requests.post(url=graph_endpoint, json=graph_config, headers=headers) 37 | # print(response.text) 38 | 39 | today = datetime.now() 40 | today = today.strftime("%Y%m%d") 41 | 42 | # Adding a Pixel 43 | add_pixel_endpoint = f"{pixela_endpoint}/{USERNAME}/graphs/{GRAPH_ID}" 44 | pixel_config = { 45 | # Read strftime documentation online to learn abt diff placeholders 46 | "date": today, 47 | "quantity": "9.5" 48 | } 49 | 50 | # response = requests.post(url=add_pixel_endpoint, json=pixel_config, headers=headers) 51 | # print(response.text) 52 | 53 | # PUT changes the data and DELETE deleted the data 54 | 55 | # Changing Values using PUT 56 | change_value_endpoint = f"{pixela_endpoint}/{USERNAME}/graphs/{GRAPH_ID}/{today}" 57 | change_param = { 58 | "quantity": "10" 59 | } 60 | # response = requests.put(url=change_value_endpoint, json=change_param, headers=headers) 61 | # print(response.text) 62 | 63 | # Deleting a Pixel 64 | delete_endpoint = change_value_endpoint 65 | # No delete params req 66 | # response = requests.delete(url=delete_endpoint, headers=headers) 67 | # print(response.text) 68 | -------------------------------------------------------------------------------- /Day 38 Workout Tracker With Python & Google Sheets/README.md: -------------------------------------------------------------------------------- 1 | Exercise Tracking with Python and Google Sheets 2 | -------------------------------------------------------------------------------- /Day 38 Workout Tracker With Python & Google Sheets/main.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from datetime import datetime 3 | import os 4 | 5 | GENDER = YOUR GENDER 6 | WEIGHT_KG = YOUR WEIGHT 7 | HEIGHT_CM = YOUR HEIGHT 8 | AGE = YOUR AGE 9 | 10 | APP_ID = os.environ["NT_APP_ID"] 11 | API_KEY = os.environ["NT_API_KEY"] 12 | 13 | exercise_endpoint = "https://trackapi.nutritionix.com/v2/natural/exercise" 14 | sheet_endpoint = os.environ["SHEET_ENDPOINT"] 15 | 16 | exercise_text = input("Tell me which exercises you did: ") 17 | 18 | headers = { 19 | "x-app-id": APP_ID, 20 | "x-app-key": API_KEY, 21 | } 22 | 23 | parameters = { 24 | "query": exercise_text, 25 | "gender": GENDER, 26 | "weight_kg": WEIGHT_KG, 27 | "height_cm": HEIGHT_CM, 28 | "age": AGE 29 | } 30 | 31 | response = requests.post(exercise_endpoint, json=parameters, headers=headers) 32 | result = response.json() 33 | 34 | today = datetime.now().strftime("%d/%m/%Y") 35 | now = datetime.now().strftime("%X") 36 | 37 | bearer_headers = { 38 | "Authorization": f"Bearer {os.environ['TOKEN']}" 39 | } 40 | 41 | for exercise in result["exercises"]: 42 | sheet_inputs = { 43 | "workout": { 44 | "date": today, 45 | "time": now, 46 | "exercise": exercise["name"].title(), 47 | "duration": exercise["duration_min"], 48 | "calories": exercise["nf_calories"] 49 | } 50 | } 51 | 52 | sheet_response = requests.post(sheet_endpoint, json=sheet_inputs, headers=bearer_headers) 53 | 54 | print(sheet_response.text) -------------------------------------------------------------------------------- /Day 39-40 Flight Club/README.md: -------------------------------------------------------------------------------- 1 | Flight Club Project 2 | -------------------------------------------------------------------------------- /Day 39-40 Flight Club/data_manager.py: -------------------------------------------------------------------------------- 1 | from pprint import pprint 2 | import requests 3 | 4 | SHEETY_PRICES_ENDPOINT = YOUR SHEETY PRICES ENDPOINT 5 | SHEETY_USERS_ENDPOINT = YOUR SHEETY USERS ENDPOINT 6 | 7 | class DataManager: 8 | 9 | def __init__(self): 10 | self.destination_data = {} 11 | 12 | def get_destination_data(self): 13 | response = requests.get(url=SHEETY_PRICES_ENDPOINT) 14 | data = response.json() 15 | self.destination_data = data["prices"] 16 | return self.destination_data 17 | 18 | def update_destination_codes(self): 19 | for city in self.destination_data: 20 | new_data = { 21 | "price": { 22 | "iataCode": city["iataCode"] 23 | } 24 | } 25 | response = requests.put( 26 | url=f"{SHEETY_PRICES_ENDPOINT}/{city['id']}", 27 | json=new_data 28 | ) 29 | print(response.text) 30 | 31 | def get_customer_emails(self): 32 | customers_endpoint = SHEETY_USERS_ENDPOINT 33 | response = requests.get(url=customers_endpoint) 34 | data = response.json() 35 | self.customer_data = data["users"] 36 | return self.customer_data 37 | -------------------------------------------------------------------------------- /Day 39-40 Flight Club/flight_data.py: -------------------------------------------------------------------------------- 1 | class FlightData: 2 | 3 | def __init__( 4 | self, price, origin_city, origin_airport, destination_city, destination_airport, out_date, return_date, stop_overs=0, via_city=""): 5 | self.price = price 6 | self.origin_city = origin_city 7 | self.origin_airport = origin_airport 8 | self.destination_city = destination_city 9 | self.destination_airport = destination_airport 10 | self.out_date = out_date 11 | self.return_date = return_date 12 | self.stop_overs = stop_overs 13 | self.via_city = via_city 14 | -------------------------------------------------------------------------------- /Day 39-40 Flight Club/flight_search.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from flight_data import FlightData 3 | 4 | TEQUILA_ENDPOINT = "https://tequila-api.kiwi.com" 5 | TEQUILA_API_KEY = YOUR FLIGHT SEARCH API KEY 6 | 7 | 8 | class FlightSearch: 9 | 10 | def get_destination_code(self, city_name): 11 | location_endpoint = f"{TEQUILA_ENDPOINT}/locations/query" 12 | headers = {"apikey": TEQUILA_API_KEY} 13 | query = {"term": city_name, "location_types": "city"} 14 | response = requests.get(url=location_endpoint, headers=headers, params=query) 15 | results = response.json()["locations"] 16 | code = results[0]["code"] 17 | return code 18 | 19 | def check_flights(self, origin_city_code, destination_city_code, from_time, to_time): 20 | headers = {"apikey": TEQUILA_API_KEY} 21 | query = { 22 | "fly_from": origin_city_code, 23 | "fly_to": destination_city_code, 24 | "date_from": from_time.strftime("%d/%m/%Y"), 25 | "date_to": to_time.strftime("%d/%m/%Y"), 26 | "nights_in_dst_from": 7, 27 | "nights_in_dst_to": 28, 28 | "flight_type": "round", 29 | "one_for_city": 1, 30 | "max_stopovers": 0, 31 | "curr": "GBP" 32 | } 33 | 34 | response = requests.get( 35 | url=f"{TEQUILA_ENDPOINT}/v2/search", 36 | headers=headers, 37 | params=query, 38 | ) 39 | try: 40 | data = response.json()["data"][0] 41 | except IndexError: 42 | query["max_stopovers"] = 1 43 | response = requests.get( 44 | url=f"{TEQUILA_ENDPOINT}/v2/search", 45 | headers=headers, 46 | params=query, 47 | ) 48 | data = response.json()["data"][0] 49 | pprint(data) 50 | flight_data = FlightData( 51 | price=data["price"], 52 | origin_city=data["route"][0]["cityFrom"], 53 | origin_airport=data["route"][0]["flyFrom"], 54 | destination_city=data["route"][1]["cityTo"], 55 | destination_airport=data["route"][1]["flyTo"], 56 | out_date=data["route"][0]["local_departure"].split("T")[0], 57 | return_date=data["route"][2]["local_departure"].split("T")[0], 58 | stop_overs=1, 59 | via_city=data["route"][0]["cityTo"] 60 | ) 61 | return flight_data 62 | else: 63 | flight_data = FlightData( 64 | price=data["price"], 65 | origin_city=data["route"][0]["cityFrom"], 66 | origin_airport=data["route"][0]["flyFrom"], 67 | destination_city=data["route"][0]["cityTo"], 68 | destination_airport=data["route"][0]["flyTo"], 69 | out_date=data["route"][0]["local_departure"].split("T")[0], 70 | return_date=data["route"][1]["local_departure"].split("T")[0] 71 | ) 72 | 73 | return flight_data 74 | -------------------------------------------------------------------------------- /Day 39-40 Flight Club/main.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime, timedelta 2 | from data_manager import DataManager 3 | from flight_search import FlightSearch 4 | from notification_manager import NotificationManager 5 | 6 | 7 | ORIGIN_CITY_IATA = "MUM" 8 | 9 | data_manager = DataManager() 10 | flight_search = FlightSearch() 11 | notification_manager = NotificationManager() 12 | 13 | sheet_data = data_manager.get_destination_data() 14 | 15 | if sheet_data[0]["iataCode"] == "": 16 | city_names = [row["city"] for row in sheet_data] 17 | data_manager.city_codes = flight_search.get_destination_codes(city_names) 18 | data_manager.update_destination_codes() 19 | sheet_data = data_manager.get_destination_data() 20 | 21 | destinations = { 22 | data["iataCode"]: { 23 | "id": data["id"], 24 | "city": data["city"], 25 | "price": data["lowestPrice"] 26 | } for data in sheet_data} 27 | 28 | tomorrow = datetime.now() + timedelta(days=1) 29 | six_month_from_today = datetime.now() + timedelta(days=6 * 30) 30 | 31 | for destination_code in destinations: 32 | flight = flight_search.check_flights( 33 | ORIGIN_CITY_IATA, 34 | destination_code, 35 | from_time=tomorrow, 36 | to_time=six_month_from_today 37 | ) 38 | print(flight.price) 39 | if flight is None: 40 | continue 41 | 42 | if flight.price < destinations[destination_code]["price"]: 43 | 44 | users = data_manager.get_customer_emails() 45 | emails = [row["email"] for row in users] 46 | names = [row["firstName"] for row in users] 47 | 48 | message = f"Low price alert! Only £{flight.price} to fly from {flight.origin_city}-{flight.origin_airport} to {flight.destination_city}-{flight.destination_airport}, from {flight.out_date} to {flight.return_date}." 49 | 50 | if flight.stop_overs > 0: 51 | message += f"\nFlight has {flight.stop_overs} stop over, via {flight.via_city}." 52 | 53 | link = f"https://www.google.co.uk/flights?hl=en#flt={flight.origin_airport}.{flight.destination_airport}.{flight.out_date}*{flight.destination_airport}.{flight.origin_airport}.{flight.return_date}" 54 | 55 | notification_manager.send_emails(emails, message, link) 56 | -------------------------------------------------------------------------------- /Day 39-40 Flight Club/notification_manager.py: -------------------------------------------------------------------------------- 1 | import smtplib 2 | from twilio.rest import Client 3 | 4 | TWILIO_SID = YOUR TWILIO ACCOUNT SID 5 | TWILIO_AUTH_TOKEN = YOUR TWILIO AUTH TOKEN 6 | TWILIO_VIRTUAL_NUMBER = YOUR TWILIO VIRTUAL NUMBER 7 | TWILIO_VERIFIED_NUMBER = YOUR TWILIO VERIFIED NUMBER 8 | MAIL_PROVIDER_SMTP_ADDRESS = YOUR EMAIL PROVIDER SMTP ADDRESS "smtp.gmail.com" 9 | MY_EMAIL = YOUR EMAIL 10 | MY_PASSWORD = YOUR PASSWORD 11 | 12 | class NotificationManager: 13 | 14 | def __init__(self): 15 | self.client = Client(TWILIO_SID, TWILIO_AUTH_TOKEN) 16 | 17 | def send_sms(self, message): 18 | message = self.client.messages.create( 19 | body=message, 20 | from_=TWILIO_VIRTUAL_NUMBER, 21 | to=TWILIO_VERIFIED_NUMBER, 22 | ) 23 | print(message.sid) 24 | 25 | def send_emails(self, emails, message, google_flight_link): 26 | with smtplib.SMTP(MAIL_PROVIDER_SMTP_ADDRESS) as connection: 27 | connection.starttls() 28 | connection.login(MY_EMAIL, MY_PASSWORD) 29 | for email in emails: 30 | connection.sendmail( 31 | from_addr=MY_EMAIL, 32 | to_addrs=email, 33 | msg=f"Subject:New Low Price Flight!\n\n{message}\n{google_flight_link}".encode('utf-8') 34 | ) 35 | -------------------------------------------------------------------------------- /Day 3: Interactive Treasure Island Story Game.py: -------------------------------------------------------------------------------- 1 | #Link to Treasure Game : 2 | 3 | #https://replit.com/@PrachetShah/treasure-island-project?embed=1&output=1#main.py 4 | 5 | #Code: 6 | 7 | print(''' 8 | ******************************************************************************* 9 | | | | | 10 | _________|________________.=""_;=.______________|_____________________|_______ 11 | | | ,-"_,="" `"=.| | 12 | |___________________|__"=._o`"-._ `"=.______________|___________________ 13 | | `"=._o`"=._ _`"=._ | 14 | _________|_____________________:=._o "=._."_.-="'"=.__________________|_______ 15 | | | __.--" , ; `"=._o." ,-"""-._ ". | 16 | |___________________|_._" ,. .` ` `` , `"-._"-._ ". '__|___________________ 17 | | |o`"=._` , "` `; .". , "-._"-._; ; | 18 | _________|___________| ;`-.o`"=._; ." ` '`."\` . "-._ /_______________|_______ 19 | | | |o; `"-.o`"=._`` '` " ,__.--o; | 20 | |___________________|_| ; (#) `-.o `"=.`_.--"_o.-; ;___|___________________ 21 | ____/______/______/___|o;._ " `".o|o_.--" ;o;____/______/______/____ 22 | /______/______/______/_"=._o--._ ; | ; ; ;/______/______/______/_ 23 | ____/______/______/______/__"=._o--._ ;o|o; _._;o;____/______/______/____ 24 | /______/______/______/______/____"=._o._; | ;_.--"o.--"_/______/______/______/_ 25 | ____/______/______/______/______/_____"=.o|o_.--""___/______/______/______/____ 26 | /______/______/______/______/______/______/______/______/______/______/_____ / 27 | ******************************************************************************* 28 | ''') 29 | print("Welcome to Treasure Island.") 30 | print("Your mission is to find the treasure.") 31 | choice1 = input("You\'ve arrived at a crossroad, which direction would you like to go:\n Left or Right :").lower() 32 | if(choice1 == "left"): 33 | print("\nGreat Choice!!!, You have come across a lake with an island in between!!") 34 | choice2 = input("You have 2 choices to choose from: 1)Wait or 2)Swim : \n").lower() 35 | if(choice2 == "wait"): 36 | print("\nPatience is always the Key, Nice Job") 37 | print("One more puzzle and the treasure is all yours") 38 | 39 | choice3 = input("\nThere are 2 doors to choose from: 1)Red, 2)Blue, 3)Yellow: ").lower() 40 | if(choice3 == "yellow"): 41 | print("\nYou Winn, Congrats!!!") 42 | elif(choice3 == "red"): 43 | print("\nGame Over") 44 | else: 45 | print("\nGame Over") 46 | 47 | else: 48 | print("\nAlligators ate you alive\n") 49 | print(''' 50 | .-._ _ _ _ _ _ _ _ _ 51 | .-''-.__.-'00 '-' ' ' ' ' ' ' ' '-. 52 | '.___ ' . .--_'-' '-' '-' _'-' '._ 53 | V: V 'vv-' '_ '. .' _..' '.'. 54 | '=.____.=_.--' :_.__.__:_ '. : : 55 | (((____.-' '-. / : : 56 | (((-'\ .' / 57 | _____..' .' 58 | '-._____.-' 59 | ''') 60 | print("\nGAME OVER ") 61 | else: 62 | print("Lion chased you out of Jungle, it's GAME OVER for you :(") 63 | -------------------------------------------------------------------------------- /Day 41 Web Foundation: Intro to HTML/README.md: -------------------------------------------------------------------------------- 1 | Started learning HTML today for Web Development and created a website that looks from the 90's 2 | -------------------------------------------------------------------------------- /Day 41 Web Foundation: Intro to HTML/contactMe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Contact Details 6 | 7 | 8 |

Contact Details:

9 |

10 | Email: prachetshah25@gmail.com
11 | Phone: +91 9819396489 12 |

13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Day 41 Web Foundation: Intro to HTML/hobbies.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | My Hobbies 6 | 7 | 8 |

Hobbies:

9 |
    10 |
  1. Coding
  2. 11 |
  3. Walking
  4. 12 |
  5. Badminton
  6. 13 |
  7. Gaming
  8. 14 |
15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /Day 41 Web Foundation: Intro to HTML/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 😎Prachet's Personal Site 7 | 8 | 9 | 10 | prachet profile picture 11 |

Prachet Shah

12 |

First Year Engineering Student at DJSCE. 13 | 14 | 15 | 16 |

17 | 25 |

Hello, I am a student and a keen learner, with knowledge of C++, Python, Machine Learning,
26 | and the Basics of Deep Learning.I love learning new things and I am a quick learner, 27 | a great team player,
and love doing projects by applying the concepts I have taught myself over these years.

28 | My Hobbies 29 |
30 | 31 | 32 |

Education:

33 | 41 |
42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Day 41 Web Foundation: Intro to HTML/prachet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 41 Web Foundation: Intro to HTML/prachet.png -------------------------------------------------------------------------------- /Day 42,43 and 44/README.md: -------------------------------------------------------------------------------- 1 | Started working on my personal website using HTML, & CSS while learning them 2 | -------------------------------------------------------------------------------- /Day 45 Intro to Web Scraping using BeautifulSoup/README.md: -------------------------------------------------------------------------------- 1 | Web Scraping using BeautifulSoup 2 | -------------------------------------------------------------------------------- /Day 45 Intro to Web Scraping using BeautifulSoup/main.py: -------------------------------------------------------------------------------- 1 | ####Introduction to Web Scraping##### 2 | from bs4 import BeautifulSoup 3 | 4 | #Alternative parsing module 5 | import lxml 6 | 7 | with open("website.html") as file: 8 | contents = file.read() 9 | 10 | #This is how you make soup 11 | soup = BeautifulSoup(contents, "html.parser") 12 | 13 | # print(soup.title) 14 | # print(soup.title.string) 15 | 16 | # Prettify will add indentation to the soup. 17 | # print(soup) 18 | # print(soup.prettify()) 19 | 20 | # You can access the first tag of any kind by using .p or .a or .h1 etc. 21 | # print(soup.p) 22 | 23 | # You can create a list of all occurances of tag with find_all() 24 | all_anchor_tags = soup.find_all(name="a") 25 | # print(all_anchor_tags) 26 | 27 | # for tag in all_anchor_tags: 28 | #getText() gets the text in the tag. 29 | # print(tag.getText()) 30 | # get() can get the value of any tag attribute. 31 | # print(tag.get("href")) 32 | 33 | # find() works like find_all() but just gets the first occurance. 34 | # You can also find by id. 35 | heading = soup.find(name="h1", id="name") 36 | # print(heading) 37 | 38 | #You can also find by class_ name. 39 | section_heading = soup.find(name="h3", class_="heading") 40 | # print(section_heading.getText()) 41 | # print(section_heading.name) 42 | # print(section_heading.get("class")) 43 | 44 | #You can also find by using a CSS Selector: 45 | print(soup.select_one(selector=".company a")) 46 | print(soup.select("a")) 47 | 48 | 49 | 50 | ##############Scraping Hacker News######### 51 | from bs4 import BeautifulSoup 52 | import requests 53 | 54 | response = requests.get("https://news.ycombinator.com/news") 55 | yc_web_page = response.text 56 | 57 | soup = BeautifulSoup(yc_web_page, "html.parser") 58 | articles = soup.find_all(name="a", class_="storylink") 59 | article_texts = [] 60 | article_links = [] 61 | for article_tag in articles: 62 | text = article_tag.getText() 63 | article_texts.append(text) 64 | link = article_tag.get("href") 65 | article_links.append(link) 66 | 67 | article_upvotes = [int(score.getText().split()[0]) for score in soup.find_all(name="span", class_="score")] 68 | 69 | largest_number = max(article_upvotes) 70 | largest_index = article_upvotes.index(largest_number) 71 | 72 | print(article_texts[largest_index]) 73 | print(article_links[largest_index]) 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /Day 45 Intro to Web Scraping using BeautifulSoup/website.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Angela's Personal Site 7 | 8 | 9 | 10 |

Angela Yu

11 |

Founder of The App Brewery.

12 |

I am an iOS and Web Developer. I ❤️ coffee and motorcycles.

13 |
14 |

Books and Teaching

15 | 20 |
21 |

Other Pages

22 | My Hobbies 23 | Contact Me 24 | 25 | 26 | -------------------------------------------------------------------------------- /Day 46 Musical Time Machine using SpotifyDeveloper/README.md: -------------------------------------------------------------------------------- 1 | Musical Time Machine 2 | -------------------------------------------------------------------------------- /Day 46 Musical Time Machine using SpotifyDeveloper/main.py: -------------------------------------------------------------------------------- 1 | URL = "https://www.billboard.com/charts/hot-100/" 2 | CLIENT_ID = YOUR_SPOTIFY_CLIENT_ID 3 | CLIENT_SECRET = YOUR_SPOTIFY_KEY 4 | from bs4 import BeautifulSoup 5 | import requests 6 | import spotipy 7 | from spotipy.oauth2 import SpotifyOAuth 8 | 9 | # Scraping Billboard 100 10 | date = input("Which year do you want to travel to? Type the date in this format YYYY-MM-DD: ") 11 | response = requests.get("https://www.billboard.com/charts/hot-100/" + date) 12 | soup = BeautifulSoup(response.text, 'html.parser') 13 | song_names_spans = soup.find_all("span", class_="chart-element__information__song") 14 | song_names = [song.getText() for song in song_names_spans] 15 | 16 | #Spotify Authentication 17 | sp = spotipy.Spotify( 18 | auth_manager=SpotifyOAuth( 19 | scope="playlist-modify-private", 20 | redirect_uri="http://example.com", 21 | client_id= CLIENT_ID, 22 | client_secret= CLIENT_SECRET, 23 | show_dialog=True, 24 | cache_path="token.txt" 25 | ) 26 | ) 27 | user_id = sp.current_user()["id"] 28 | print(user_id) 29 | 30 | #Searching Spotify for songs by title 31 | song_uris = [] 32 | year = date.split("-")[0] 33 | for song in song_names: 34 | result = sp.search(q=f"track:{song} year:{year}", type="track") 35 | print(result) 36 | try: 37 | uri = result["tracks"]["items"][0]["uri"] 38 | song_uris.append(uri) 39 | except IndexError: 40 | print(f"{song} doesn't exist in Spotify. Skipped.") 41 | 42 | #Creating a new private playlist in Spotify 43 | playlist = sp.user_playlist_create(user=user_id, name=f"{date} Billboard 100", public=False) 44 | print(playlist) 45 | 46 | #Adding songs found into the new playlist 47 | sp.playlist_add_items(playlist_id=playlist["id"], items=song_uris) 48 | -------------------------------------------------------------------------------- /Day 47 Amazon Price Tracker Bot/README.md: -------------------------------------------------------------------------------- 1 | Amazon Price Tracker 2 | -------------------------------------------------------------------------------- /Day 47 Amazon Price Tracker Bot/main.py: -------------------------------------------------------------------------------- 1 | import smtplib 2 | import requests 3 | from bs4 import BeautifulSoup 4 | import lxml 5 | 6 | AMAZON_URL = "https://www.amazon.in/Logitech-Hyperion-Ultra-Gaming-Mouse/dp/B00NFD0ETQ/ref=pd_ys_c_rfy_976419031_3?_encoding=UTF8&pd_rd_i=B00NFD0ETQ&pd_rd_r=3WAFG6WBTF6S10ZN0WK0&pd_rd_w=hkdHJ&pd_rd_wg=UqhDE&pf_rd_p=a48c231b-e90e-4225-8c14-1ea8f540ac4f&psc=1&refRID=7GZ73WYN98CB709YKVCA" 7 | my_email = YOUR_GMAIL # Remember only gmailwill work here because we have chosen our host as gmail, you can change it if you want 8 | password = YOUR_PASSWORD 9 | 10 | #change your headers from http://myhttpheader.com/ 11 | headers = { 12 | "User-Agent": USER_AGENT, 13 | "Accept-Language": "en-US,en;q=0.9", 14 | "X-Real-Ip": X_REAL_IP, 15 | "Accept": ACCEPT, 16 | "Accept-Encoding": ACCEPT_ENCODING, 17 | } 18 | 19 | response = requests.get(url=AMAZON_URL, headers=headers) 20 | webpage = response.text 21 | # print(webpage) 22 | 23 | soup = BeautifulSoup(webpage, 'lxml') 24 | # print(soup.prettify()) 25 | result = soup.find("span", id="priceblock_ourprice").getText() 26 | price = result.split("₹")[1] 27 | price = price.split(",") 28 | price = "".join(price) 29 | float_price = float(price) 30 | print(float_price) 31 | 32 | with smtplib.SMTP(host="smtp.gmail.com", port=587) as connection: 33 | # This line makes the connection secure by encrypting the message 34 | connection.starttls() 35 | connection.login(user=my_email, password=password) 36 | connection.sendmail(from_addr=my_email, 37 | to_addrs=TO_EMAIL_ADDRESS, 38 | msg= f"Subject:Amazon Price Tracker Bot\n\nHello,\nThe product Logitech G402 Hyperion Fury " 39 | f"Wired Gaming Mouse is available for Rs.{float_price} \nURL:{AMAZON_URL}") 40 | -------------------------------------------------------------------------------- /Day 48 Selenium Web Scraping/README.md: -------------------------------------------------------------------------------- 1 | Web Scraping using Selenium Web Driver 2 | -------------------------------------------------------------------------------- /Day 48 Selenium Web Scraping/main.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | import time 3 | 4 | chrome_driver_path = YOUR CHROME DRIVER PATH 5 | driver = webdriver.Chrome(chrome_driver_path) 6 | driver.get("http://orteil.dashnet.org/experiments/cookie/") 7 | 8 | #Get cookie to click on. 9 | cookie = driver.find_element_by_id("cookie") 10 | 11 | #Get upgrade item ids. 12 | items = driver.find_elements_by_css_selector("#store div") 13 | item_ids = [item.get_attribute("id") for item in items] 14 | 15 | timeout = time.time() + 5 16 | five_min = time.time() + 60*5 # 5minutes 17 | 18 | while True: 19 | cookie.click() 20 | 21 | #Every 5 seconds: 22 | if time.time() > timeout: 23 | 24 | #Get all upgrade tags 25 | all_prices = driver.find_elements_by_css_selector("#store b") 26 | item_prices = [] 27 | 28 | #Convert text into an integer price. 29 | for price in all_prices: 30 | element_text = price.text 31 | if element_text != "": 32 | cost = int(element_text.split("-")[1].strip().replace(",", "")) 33 | item_prices.append(cost) 34 | 35 | #Create dictionary of store items and prices 36 | cookie_upgrades = {} 37 | for n in range(len(item_prices)): 38 | cookie_upgrades[item_prices[n]] = item_ids[n] 39 | 40 | #Get current cookie count 41 | money_element = driver.find_element_by_id("money").text 42 | if "," in money_element: 43 | money_element = money_element.replace(",", "") 44 | cookie_count = int(money_element) 45 | 46 | #Find upgrades that we can currently afford 47 | affordable_upgrades = {} 48 | for cost, id in cookie_upgrades.items(): 49 | if cookie_count > cost: 50 | affordable_upgrades[cost] = id 51 | 52 | #Purchase the most expensive affordable upgrade 53 | highest_price_affordable_upgrade = max(affordable_upgrades) 54 | print(highest_price_affordable_upgrade) 55 | to_purchase_id = affordable_upgrades[highest_price_affordable_upgrade] 56 | 57 | driver.find_element_by_id(to_purchase_id).click() 58 | 59 | #Add another 5 seconds until the next check 60 | timeout = time.time() + 5 61 | 62 | #After 5 minutes stop the bot and check the cookies per second count. 63 | if time.time() > five_min: 64 | cookie_per_s = driver.find_element_by_id("cps").text 65 | print(cookie_per_s) 66 | break 67 | 68 | -------------------------------------------------------------------------------- /Day 4: Rock Paper Scissors with Computer.py: -------------------------------------------------------------------------------- 1 | #Link to Project: 2 | 3 | #https://replit.com/@PrachetShah/rock-paper-scissors?embed=1&output=1#main.py 4 | 5 | #Code: 6 | rock = ''' 7 | _______ 8 | ---' ____) 9 | (_____) 10 | (_____) 11 | (____) 12 | ---.__(___) 13 | ''' 14 | 15 | paper = ''' 16 | _______ 17 | ---' ____)____ 18 | ______) 19 | _______) 20 | _______) 21 | ---.__________) 22 | ''' 23 | 24 | scissors = ''' 25 | _______ 26 | ---' ____)____ 27 | ______) 28 | __________) 29 | (____) 30 | ---.__(___) 31 | ''' 32 | 33 | import random 34 | choice = int(input("What do you choose? 0 for Rock, 1 for Paper or 2 for Scissors. :")) 35 | image_choice = [rock,paper,scissors] 36 | print(image_choice[choice]) 37 | 38 | 39 | comp_choice = random.randint(0,2) 40 | print("Computer Chooses:\n"+image_choice[comp_choice]) 41 | 42 | #To predict result 43 | if(choice == comp_choice): 44 | print("It's a Draw") 45 | elif(choice == 0 and comp_choice == 1): 46 | print("You Lose") 47 | elif(choice == 0 and comp_choice == 2): 48 | print("You Win") 49 | elif(choice == 1 and comp_choice == 0): 50 | print("You Win") 51 | elif(choice == 1 and comp_choice == 2): 52 | print("You Lose") 53 | elif(choice == 2 and comp_choice == 0): 54 | print("You Lose") 55 | elif(choice == 2 and comp_choice == 1): 56 | print("You Win") 57 | -------------------------------------------------------------------------------- /Day 50 Tinder Swiping Bot/README.md: -------------------------------------------------------------------------------- 1 | Tinder Swiping Bot using Python Selenium 2 | -------------------------------------------------------------------------------- /Day 50 Tinder Swiping Bot/main.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver.common.keys import Keys 3 | from selenium.common.exceptions import ElementClickInterceptedException, NoSuchElementException 4 | from time import sleep 5 | 6 | FB_EMAIL = YOUR FACEBOOK LOGIN EMAIL 7 | FB_PASSWORD = YOUR FACEBOOK PASSWORD 8 | 9 | chrome_driver_path = YOUR CHROME DRIVER PATH 10 | driver = webdriver.Chrome(executable_path=chrome_driver_path) 11 | 12 | driver.get("http://www.tinder.com") 13 | 14 | sleep(2) 15 | login_button = driver.find_element_by_xpath('//*[@id="content"]/div/div[1]/div/main/div[1]/div/div/header/div[1]/div[2]/div/button') 16 | login_button.click() 17 | 18 | sleep(2) 19 | fb_login = driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div[1]/div/div[3]/span/div[2]/button') 20 | fb_login.click() 21 | 22 | sleep(2) 23 | base_window = driver.window_handles[0] 24 | fb_login_window = driver.window_handles[1] 25 | driver.switch_to.window(fb_login_window) 26 | print(driver.title) 27 | 28 | email = driver.find_element_by_xpath('//*[@id="email"]') 29 | password = driver.find_element_by_xpath('//*[@id="pass"]') 30 | 31 | email.send_keys(FB_EMAIL) 32 | password.send_keys(FB_PASSWORD) 33 | password.send_keys(Keys.ENTER) 34 | 35 | driver.switch_to.window(base_window) 36 | print(driver.title) 37 | 38 | sleep(5) 39 | allow_location_button = driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div/div/div[3]/button[1]') 40 | allow_location_button.click() 41 | notifications_button = driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div/div/div[3]/button[2]') 42 | notifications_button.click() 43 | cookies = driver.find_element_by_xpath('//*[@id="content"]/div/div[2]/div/div/div[1]/button') 44 | cookies.click() 45 | 46 | #Tinder free tier only allows 100 "Likes" per day. If you have a premium account, feel free to change to a while loop. 47 | for n in range(100): 48 | 49 | #Add a 1 second delay between likes. 50 | sleep(1) 51 | 52 | try: 53 | print("called") 54 | like_button = driver.find_element_by_xpath( 55 | '//*[@id="content"]/div/div[1]/div/main/div[1]/div/div/div[1]/div/div[2]/div[4]/button') 56 | like_button.click() 57 | 58 | #Catches the cases where there is a "Matched" pop-up in front of the "Like" button: 59 | except ElementClickInterceptedException: 60 | try: 61 | match_popup = driver.find_element_by_css_selector(".itsAMatch a") 62 | match_popup.click() 63 | 64 | #Catches the cases where the "Like" button has not yet loaded, so wait 2 seconds before retrying. 65 | except NoSuchElementException: 66 | sleep(2) 67 | 68 | driver.quit() -------------------------------------------------------------------------------- /Day 51 Twitter Complaint Bot/README.md: -------------------------------------------------------------------------------- 1 |

Twitter Complaint Bot

Twitter Bot created wiht the help of Selenium Web Driver using Web Scraping and Python without using any inbuilt python module 2 | -------------------------------------------------------------------------------- /Day 51 Twitter Complaint Bot/Twitter_Bot.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver.common.keys import Keys 3 | from selenium.common.exceptions import NoSuchElementException 4 | import time 5 | 6 | PROMISED_DOWN = 30 7 | PROMISED_UP = 25 8 | CHROME_DRIVER_PATH = CHROME_DRIVER_PATH 9 | TWITTER_USERNAME = USERNAME 10 | TWITTER_PASS = PASSWORD 11 | 12 | 13 | class InternetSpeedTwitterBot: 14 | def __init__(self, down, up): 15 | self.driver = webdriver.Chrome(CHROME_DRIVER_PATH) 16 | self.down = down 17 | self.up = up 18 | 19 | def get_internet_speed(self): 20 | self.driver.get("https://www.speedtest.net/") 21 | self.go = self.driver.find_element_by_css_selector("a .start-text") 22 | self.go.click() 23 | 24 | time.sleep(45) 25 | self.download = self.driver.find_element_by_css_selector("div .result-data .download-speed") 26 | self.download = self.download.text 27 | self.upload = self.driver.find_element_by_css_selector("div .result-data .upload-speed") 28 | self.upload = self.upload.text 29 | 30 | def tweet_at_provider(self): 31 | self.driver.get("https://twitter.com/login") 32 | 33 | time.sleep(3) 34 | username = self.driver.find_element_by_xpath( 35 | '//*[@id="react-root"]/div/div/div[2]/main/div/div/div[2]/form/div/div[1]/label/div/div[2]/div/input') 36 | username.send_keys(TWITTER_USERNAME) 37 | 38 | time.sleep(2) 39 | password = self.driver.find_element_by_xpath( 40 | '//*[@id="react-root"]/div/div/div[2]/main/div/div/div[2]/form/div/div[2]/label/div/div[2]/div/input') 41 | password.send_keys(TWITTER_PASS) 42 | password.send_keys(Keys.ENTER) 43 | 44 | time.sleep(5) 45 | tweet = self.driver.find_element_by_xpath( 46 | '//*[@id="react-root"]/div/div/div[2]/main/div/div/div/div[1]/div/div[2]/div/div[2]/div[1]/div/div/div/div[2]/div[1]/div/div/div/div/div/div/div/div/label/div[1]/div/div/div/div/div[2]/div') 47 | tweet.send_keys(f"Hey Internet Provider, why is my internet speed down to {self.download} and upload speed is" 48 | f" {self.upload} when i pay for {self.down}mbps/{self.up}mbps ") 49 | 50 | time.sleep(2) 51 | send_tweet = self.driver.find_element_by_xpath( 52 | '//*[@id="react-root"]/div/div/div[2]/main/div/div/div/div[1]/div/div[2]/div/div[2]/div[1]/div/div/div/div[2]/div[3]/div/div/div[2]/div[3]/div') 53 | send_tweet.click() 54 | 55 | 56 | speed = InternetSpeedTwitterBot(PROMISED_DOWN, PROMISED_UP) 57 | speed.get_internet_speed() 58 | speed.tweet_at_provider() 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /Day 52 Instagram Follower Bot/Insta_Follow_Bot.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver.common.keys import Keys 3 | from selenium.common.exceptions import ElementClickInterceptedException 4 | import time 5 | 6 | CHROME_DRIVER_PATH = YOURCHROMEDRIVERPATH 7 | INSTA_USER = ACC_USER 8 | INSTA_PASS = ACC_PASS 9 | SEARCH_ACC = ACCOUNT_YOU_WANT_TO_SEARCH 10 | 11 | 12 | class InstaFollower: 13 | def __init__(self): 14 | self.driver = webdriver.Chrome(CHROME_DRIVER_PATH) 15 | self.driver.get("https://www.instagram.com/") 16 | 17 | def login(self): 18 | time.sleep(2) 19 | username = self.driver.find_element_by_xpath('//*[@id="loginForm"]/div/div[1]/div/label/input') 20 | username.send_keys(INSTA_USER) 21 | 22 | time.sleep(2) 23 | password = self.driver.find_element_by_xpath('//*[@id="loginForm"]/div/div[2]/div/label/input') 24 | password.send_keys(INSTA_PASS) 25 | password.send_keys(Keys.ENTER) 26 | 27 | time.sleep(3) 28 | not_save = self.driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/div/div/div/button') 29 | not_save.send_keys(Keys.ENTER) 30 | 31 | time.sleep(2) 32 | no_noti = self.driver.find_element_by_xpath('/html/body/div[4]/div/div/div/div[3]/button[2]') 33 | no_noti.send_keys(Keys.ENTER) 34 | 35 | def find_followers(self): 36 | time.sleep(1) 37 | search_acc = self.driver.find_element_by_xpath('//*[@id="react-root"]/section/nav/div[2]/div/div/div[2]/input') 38 | search_acc.send_keys(SEARCH_ACC) 39 | 40 | time.sleep(2) 41 | search_acc.send_keys(Keys.ENTER) 42 | time.sleep(0.5) 43 | search_acc.send_keys(Keys.ENTER) 44 | 45 | time.sleep(1) 46 | followers = self.driver.find_element_by_xpath( 47 | '//*[@id="react-root"]/section/main/div/header/section/ul/li[2]/a') 48 | followers.click() 49 | 50 | time.sleep(2) 51 | followers.send_keys(Keys.PAGE_DOWN) 52 | time.sleep(2) 53 | 54 | def follow(self): 55 | all_buttons = self.driver.find_elements_by_css_selector("li button") 56 | for button in all_buttons: 57 | try: 58 | button.click() 59 | time.sleep(1) 60 | except ElementClickInterceptedException: 61 | time.sleep(1) 62 | cancel_button = self.driver.find_element_by_xpath('/html/body/div[5]/div/div/div/div[3]/button[2]') 63 | cancel_button.click() 64 | 65 | 66 | bot = InstaFollower() 67 | bot.login() 68 | bot.find_followers() 69 | bot.follow() 70 | -------------------------------------------------------------------------------- /Day 52 Instagram Follower Bot/README.md: -------------------------------------------------------------------------------- 1 | Instagram Follower Bot created using Selenium and Python 2 | -------------------------------------------------------------------------------- /Day 53 Data Entry Job Automation/README.md: -------------------------------------------------------------------------------- 1 | A Python Script that automatically does data entry from a website and then converts it into a spreadsheet 2 | -------------------------------------------------------------------------------- /Day 53 Data Entry Job Automation/main.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from bs4 import BeautifulSoup 3 | import lxml 4 | from selenium import webdriver 5 | from selenium.webdriver.common.keys import Keys 6 | from selenium.common.exceptions import NoSuchElementException 7 | import time 8 | 9 | CHROME_DRIVER_PATH = "YOUR_CHROME_DRIVER_PATH 10 | FORM_LINK = "https://docs.google.com/forms/d/e/1FAIpQLScZM5R0byqJWR_7VicXM_ffn6CS-gBxRlS493QRRfzSM9I3Kg/viewform?usp=sf_link" 11 | 12 | headers = { 13 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.67", 14 | "Accept-Language": YOUR_PC, 15 | "X-Real-Ip": YOURIP, 16 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", 17 | "Accept-Encoding": "gzip, deflate", 18 | } 19 | URL = "https://www.zillow.com/homes/for_rent/1-_beds/?searchQueryState=%7B%22pagination%22%3A%7B%7D%2C%22mapBounds%22%3A%7B%22west%22%3A-122.56825484228516%2C%22east%22%3A-122.29840315771484%2C%22south%22%3A37.73932632963956%2C%22north%22%3A37.81123909008061%7D%2C%22mapZoom%22%3A12%2C%22isMapVisible%22%3Atrue%2C%22filterState%22%3A%7B%22price%22%3A%7B%22max%22%3A872627%7D%2C%22beds%22%3A%7B%22min%22%3A1%7D%2C%22fore%22%3A%7B%22value%22%3Afalse%7D%2C%22mp%22%3A%7B%22max%22%3A3000%7D%2C%22auc%22%3A%7B%22value%22%3Afalse%7D%2C%22nc%22%3A%7B%22value%22%3Afalse%7D%2C%22fr%22%3A%7B%22value%22%3Atrue%7D%2C%22fsbo%22%3A%7B%22value%22%3Afalse%7D%2C%22cmsn%22%3A%7B%22value%22%3Afalse%7D%2C%22fsba%22%3A%7B%22value%22%3Afalse%7D%7D%2C%22isListVisible%22%3Atrue%7D" 20 | webpage = requests.get(URL, headers=headers) 21 | webpage = webpage.text 22 | 23 | soup = BeautifulSoup(webpage, 'html.parser') 24 | 25 | all_price_elements = soup.select("div .list-card-price") 26 | print(all_price_elements) 27 | # all_prices = [price for price in all_price_elements if "$" in price.text] 28 | 29 | all_link_elements = soup.select(".list-card-top a") 30 | all_links = [] 31 | for link in all_link_elements: 32 | href = link["href"] 33 | if "http" not in href: 34 | all_links.append(f"https://www.zillow.com{href}") 35 | else: 36 | all_links.append(href) 37 | 38 | 39 | all_address_elements = soup.select(".list-card-info address") 40 | all_addresses = [address.get_text().split(" | ")[-1] for address in all_address_elements] 41 | 42 | driver = webdriver.Chrome(CHROME_DRIVER_PATH) 43 | 44 | for n in range(len(all_links)): 45 | driver.get(FORM_LINK) 46 | address = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div[2]/div/div[2]/div[1]/div/div/div[2]/div/div[1]/div/div[1]/input') 47 | 48 | price = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div[2]/div/div[2]/div[2]/div/div/div[2]/div/div[1]/div/div[1]/input') 49 | 50 | link = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div[2]/div/div[2]/div[3]/div/div/div[2]/div/div[1]/div/div[1]/input') 51 | 52 | submit = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div[2]/div/div[3]/div[1]/div/div') 53 | address.send_keys(all_addresses[n]) 54 | price.send_keys(all_prices[n]) 55 | link.send_keys(all_links[n]) 56 | submit.click() 57 | -------------------------------------------------------------------------------- /Day 54 Starting with Flask/README.md: -------------------------------------------------------------------------------- 1 | Starting with Backend Programming with Flask 2 | -------------------------------------------------------------------------------- /Day 54 Starting with Flask/hello.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | app = Flask(__name__) 3 | 4 | 5 | @app.route('/') 6 | def hello_world(): 7 | return 'Hello, World!' 8 | -------------------------------------------------------------------------------- /Day 55 Rendering HTML in Flask/README.md: -------------------------------------------------------------------------------- 1 | Rendering HTML in Flask 2 | -------------------------------------------------------------------------------- /Day 55 Rendering HTML in Flask/server.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | 3 | app = Flask(__name__) 4 | 5 | @app.route("/") 6 | def greeting(): 7 | return '' \ 8 | '

Guess a number between 0 and 9

' \ 9 | '' \ 10 | '' 11 | 12 | random_number = 5 13 | @app.route("/") 14 | def guess_number(guess): 15 | if guess > random_number: 16 | return "

Too high, try again!

" \ 17 | "elon-musk" 18 | elif guess < random_number: 19 | return "

Too low, try again!

" \ 20 | "" 21 | else: 22 | return "

You found me!

" \ 23 | "" 24 | 25 | if __name__ == "__main__": 26 | app.run(debug=True) -------------------------------------------------------------------------------- /Day 56 Advanced Rendering/README.md: -------------------------------------------------------------------------------- 1 | Advanced rendering HTML and CSS into Flask 2 | -------------------------------------------------------------------------------- /Day 56 Advanced Rendering/site.py: -------------------------------------------------------------------------------- 1 | from flask import Flask,render_template 2 | 3 | 4 | app = Flask(__name__) 5 | 6 | @app.route('/') 7 | def home(): 8 | return render_template('index.html') 9 | 10 | if __name__ == "__main__": 11 | app.run(debug=True) -------------------------------------------------------------------------------- /Day 56 Advanced Rendering/static/css/styles.css: -------------------------------------------------------------------------------- 1 | 2 | body{ margin: 0px; text-align: center; font-family: 'Merriweather', serif; } 3 | 4 | h1 { font-size: 90px; margin-top: 0; font-family: 'Sacramento', cursive; margin: 50px auto 0 auto; color: #66BFBF; } 5 | 6 | h2 { font-family: 'Montserrat', sans-serif; font-size: 2.5rem; color: #66BFBF;} 7 | 8 | h3{ font-family: 'Montserrat', sans-serif; color: #11999E; } 9 | 10 | a {color: #11999E; } 11 | 12 | .pro { text-decoration: underline; } 13 | 14 | .normal {font-weight: normal;} 15 | 16 | .top-container{ padding-top: 100px; background-color: #EAF6F6; position: relative; } 17 | 18 | .bottom-container { margin: 40px; padding: 40px; background-color: #66BFBF; margin: 40px 0 0 0;} 19 | 20 | .profile-pic {padding-top: 10px; width: 250px; height: 250px; } 21 | 22 | .top-cloud { position: absolute; top: 50px; right: 370px; } 23 | 24 | .middle-cloud { position: absolute; bottom: 300px; right: 250px;} 25 | 26 | .middle-cloud-2 { position: absolute; bottom: 450px; left: 160px;} 27 | 28 | .bottom-cloud { position: absolute; left: 400px; bottom: : 300px; } 29 | 30 | .code-img { width: 25%; height: 25%; float: left; margin-left: 30px; margin-right: 10px; padding-left: 40px;} 31 | 32 | .project-logo { width: 30%; height: 30%; float: right; margin-left: 30px; margin-bottom: 10px;} 33 | 34 | .skill-row1 {width: 75%; margin: 80px 180px; text-align: left; line-height: 2; } 35 | 36 | .skill-row2 {width: 75%; margin: 80px 140px; text-align: right; line-height: 2; } 37 | 38 | .desciption { width: 75%; color: #40514E;padding-left: 60px; padding-right: 60px; margin-left: 100px;text-align: center;} 39 | 40 | .thank-you { margin-bottom: 40px;} 41 | 42 | .footer-link {padding: 15px; color: #334257; text-shadow: 2px 2px 40px white;} 43 | 44 | .bottom-greeting { padding-top: 20px; color: #EAF6F6;} 45 | hr { 46 | margin-top: 60px; 47 | margin-bottom: 60px; 48 | border-style: dotted none none; 49 | border-width: 5px; 50 | border-color: grey; 51 | width: 3%; 52 | } 53 | 54 | .btn { 55 | background: #3498db; 56 | background-image: -webkit-linear-gradient(top, #3498db, #2980b9); 57 | background-image: -moz-linear-gradient(top, #3498db, #2980b9); 58 | background-image: -ms-linear-gradient(top, #3498db, #2980b9); 59 | background-image: -o-linear-gradient(top, #3498db, #2980b9); 60 | background-image: linear-gradient(to bottom, #3498db, #2980b9); 61 | -webkit-border-radius: 28; 62 | -moz-border-radius: 28; 63 | border-radius: 28px; 64 | font-family: 'Montserrat', sans-serif; 65 | color: #ffffff; 66 | font-size: 25px; 67 | padding: 10px 20px 10px 20px; 68 | text-decoration: none; 69 | margin: 40px; 70 | } 71 | 72 | .btn:hover { 73 | background: #3cb0fd; 74 | background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db); 75 | background-image: -moz-linear-gradient(top, #3cb0fd, #3498db); 76 | background-image: -ms-linear-gradient(top, #3cb0fd, #3498db); 77 | background-image: -o-linear-gradient(top, #3cb0fd, #3498db); 78 | background-image: linear-gradient(to bottom, #3cb0fd, #3498db); 79 | text-decoration: none; 80 | } 81 | 82 | .link-btn { 83 | background: #3498db; 84 | background-image: -webkit-linear-gradient(top, #3498db, #2980b9); 85 | background-image: -moz-linear-gradient(top, #3498db, #2980b9); 86 | background-image: -ms-linear-gradient(top, #3498db, #2980b9); 87 | background-image: -o-linear-gradient(top, #3498db, #2980b9); 88 | background-image: linear-gradient(to bottom, #3498db, #2980b9); 89 | -webkit-border-radius: 28; 90 | -moz-border-radius: 28; 91 | border-radius: 28px; 92 | font-family: 'Montserrat', sans-serif; 93 | color: #ffffff; 94 | font-size: 18px; 95 | padding: 5px 10px 5px 10px; 96 | text-decoration: none; 97 | margin: 30px; 98 | } 99 | 100 | .link-btn:hover { 101 | background: #3cb0fd; 102 | background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db); 103 | background-image: -moz-linear-gradient(top, #3cb0fd, #3498db); 104 | background-image: -ms-linear-gradient(top, #3cb0fd, #3498db); 105 | background-image: -o-linear-gradient(top, #3cb0fd, #3498db); 106 | background-image: linear-gradient(to bottom, #3cb0fd, #3498db); 107 | text-decoration: none; 108 | } 109 | -------------------------------------------------------------------------------- /Day 56 Advanced Rendering/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 56 Advanced Rendering/static/favicon.ico -------------------------------------------------------------------------------- /Day 56 Advanced Rendering/static/images/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 56 Advanced Rendering/static/images/cloud.png -------------------------------------------------------------------------------- /Day 56 Advanced Rendering/static/images/mountain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 56 Advanced Rendering/static/images/mountain.png -------------------------------------------------------------------------------- /Day 56 Advanced Rendering/static/images/prachet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 56 Advanced Rendering/static/images/prachet.png -------------------------------------------------------------------------------- /Day 56 Advanced Rendering/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Prachet Shah 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | cloud-pic 16 |

I'm Prachet,

17 |

a programmer.

18 | cloud-pic 19 | cloud-pic 20 | cloud-pic 21 | mountain-pic 22 |
23 | 24 |
25 |
26 |
27 | Profile-pic 28 |

Hello.

29 |

I am a First Year Engineering Student at DJSCE, pursuing B.Tech in CS(Data Science) and a keen learner. 30 | I love learning new things and I am a quick learner, a great team player, and love doing projects by applying 31 | the concepts I have taught myself over these years.✌ 32 |

33 |
34 |
35 | 36 |
37 |

My Skills.

38 |
39 | code-img 40 |


Programming

41 |

Experienced programmer with strong knowledge of Python, C++ programming and Data Science



42 |
43 | 44 |
45 | 46 |

Some Projects

47 |

Many Projects like Quizzler App, Rain Alert Application, Stock Market News Monitoring, 48 | Pomodoro Timer,Automated Birthday and Quotes Email Sender, Password Manager, French Learning Flash Card Program 49 | can be found on my GitHub Repository. 50 |

51 | Link To Project 52 |
53 |
54 |
55 |
56 |
57 |

Get In Touch

58 |

Have any projects to work on, or to just have some coffee, message me.

59 |

Thanks for visiting. ❤

60 | CONTACT ME 61 |
62 |
63 | 64 | 65 |
66 | LinkedIn 67 | Twitter 68 | GitHub 69 |

© 2021 Prachet Shah.

70 |
71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /Day 57 Templating with Jinja/README.md: -------------------------------------------------------------------------------- 1 | Jinja Templating 2 | -------------------------------------------------------------------------------- /Day 57 Templating with Jinja/server.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template 2 | from datetime import datetime 3 | import requests 4 | 5 | date = datetime.now() 6 | 7 | app = Flask(__name__) 8 | 9 | @app.route('/') 10 | def home(): 11 | year = date.year 12 | return render_template('index.html', year=year) 13 | 14 | @app.route('/guess/') 15 | def guess(name): 16 | response = requests.get(f"https://api.agify.io?name={name}") 17 | age = response.json() 18 | age = age["age"] 19 | result = requests.get(f"https://api.genderize.io?name={name}") 20 | gender = result.json() 21 | gender = gender["gender"] 22 | return render_template('predict.html',name=name, gender=gender,age=age) 23 | 24 | @app.route('/blog') 25 | def get_blog(): 26 | response = requests.get("https://api.npoint.io/e5aa94ce16fc572668e3") 27 | all_posts = response.json() 28 | return render_template('blog.html',posts=all_posts) 29 | 30 | 31 | 32 | if __name__ == "__main__": 33 | app.run(debug=True) -------------------------------------------------------------------------------- /Day 57 Templating with Jinja/templates/blog.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Blog 6 | 7 | 8 | {% for blog_post in posts: %} 9 | {% if blog_post["id"] == 2: %} 10 |

{{ blog_post["title"] }}

11 |

{{ blog_post["subtitle"] }}

12 | {% endif %} 13 | {% endfor %} 14 | 15 | -------------------------------------------------------------------------------- /Day 57 Templating with Jinja/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Prachet 6 | 7 | 8 |

Hello, World

9 | 10 | 11 | 12 | Go to Blog 13 | 14 | 15 |
Copyright {{ year }}. Built by Prachet Shah at Home.
16 | -------------------------------------------------------------------------------- /Day 57 Templating with Jinja/templates/predict.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Predictor 6 | 7 | 8 |

Hey {{ name.title() }}

9 |

I think you are {{ gender }}

10 |

And maybe {{ age }} years old.

11 | 12 | -------------------------------------------------------------------------------- /Day 58 Bootstrap/README.md: -------------------------------------------------------------------------------- 1 | Bootstrap Framework 2 | -------------------------------------------------------------------------------- /Day 58 Bootstrap/TinDog Start Here/css/styles.css: -------------------------------------------------------------------------------- 1 | body{ 2 | font-family: "Montserrat"; 3 | text-align: center; 4 | } 5 | 6 | h1, h2, h3, h4, h5, h6 { 7 | font-family: 'Montserrat-Bold'; 8 | } 9 | 10 | h2{ 11 | font-size: 3rem; 12 | line-height: 1.5; 13 | font-weight: bold; 14 | } 15 | 16 | h3 { 17 | font-weight: bold; 18 | font-size: 1.5rem; 19 | } 20 | 21 | 22 | /* Headings */ 23 | 24 | .big-heading{ 25 | font-size: 3.5rem; 26 | line-height: 1.5; 27 | font-weight: 900; 28 | } 29 | 30 | #title{ 31 | background-color: #ff4c68; 32 | color: white; 33 | } 34 | 35 | 36 | 37 | .container-fluid{ 38 | padding: 3% 15% 7%; 39 | } 40 | 41 | /* Download Buttons */ 42 | .download-button{ 43 | margin: 5% 3% 5% 0; 44 | } 45 | 46 | /* Navigation Bar */ 47 | 48 | .navbar{ 49 | padding: 0 0 4.5rem; 50 | } 51 | 52 | .navbar-brand{ 53 | font-family: "Ubuntu"; 54 | font-size: 2.5rem; 55 | font-weight: bold; 56 | } 57 | 58 | .nav-item{ 59 | padding: 0 18px; 60 | color: #fff; 61 | } 62 | 63 | .nav-link{ 64 | font-size: 1.2rem; 65 | font-family: "Montserrat-light"; 66 | } 67 | 68 | /* Title Image */ 69 | .title-image{ 70 | width: 60%; 71 | transform: rotate(25deg); 72 | position: absolute; 73 | right: 30%; 74 | } 75 | #title{ 76 | text-align: left; 77 | } 78 | 79 | @media (max-width:1028px) { 80 | #title{ 81 | text-align: center; 82 | } 83 | 84 | .title-image{ 85 | position: static; 86 | transform: rotate(0); 87 | } 88 | } 89 | 90 | 91 | /* Features */ 92 | #features{ 93 | background-color: white; 94 | position: relative; 95 | 96 | } 97 | 98 | .fas{ 99 | color: #ef8172; 100 | /* margin-left: 20px; */ 101 | font-size: xxx-large; 102 | margin-top: 15px; 103 | } 104 | 105 | .fas:hover{ 106 | color: #ff4c68; 107 | } 108 | 109 | .feature-row{ 110 | padding: 7% 13%; 111 | line-height: 1.5; 112 | } 113 | 114 | .feature-box{ 115 | padding: 0 5%; 116 | } 117 | 118 | /* Testimonial Section */ 119 | 120 | #testimonials{ 121 | padding: 7% 16%; 122 | background-color: #ef8172; 123 | color: #fff 124 | } 125 | 126 | .testimonial-image{ 127 | width: 10%; 128 | border-radius: 100%; 129 | margin: 20px; 130 | } 131 | 132 | .carousel-item{ 133 | padding: 7% 15%; 134 | } 135 | 136 | #press{ 137 | background-color: #ef8172; 138 | padding-bottom: 3%; 139 | } 140 | 141 | .press-logo{ 142 | width: 15%; 143 | margin: 20px 20px 50px; 144 | } 145 | 146 | /* 147 | Pricing Section */ 148 | 149 | #pricing{ 150 | padding: 100px; 151 | } 152 | 153 | .pricing-col { 154 | padding: 2% 3%; 155 | } 156 | 157 | /* Call to Action */ 158 | #cta{ 159 | background-color: #ff4c68; 160 | color: white; 161 | padding: 7% 15%; 162 | line-height: 1.5; 163 | font-weight: bolder; 164 | 165 | } 166 | 167 | /* Footer Section */ 168 | 169 | 170 | #footer{ 171 | background-color: #fff; 172 | padding: 7% 15%; 173 | } 174 | 175 | .social-icon{ 176 | margin: 20px 10px; 177 | } -------------------------------------------------------------------------------- /Day 58 Bootstrap/TinDog Start Here/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 58 Bootstrap/TinDog Start Here/favicon.ico -------------------------------------------------------------------------------- /Day 58 Bootstrap/TinDog Start Here/images/TechCrunch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 58 Bootstrap/TinDog Start Here/images/TechCrunch.png -------------------------------------------------------------------------------- /Day 58 Bootstrap/TinDog Start Here/images/bizinsider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 58 Bootstrap/TinDog Start Here/images/bizinsider.png -------------------------------------------------------------------------------- /Day 58 Bootstrap/TinDog Start Here/images/dog-img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 58 Bootstrap/TinDog Start Here/images/dog-img.jpg -------------------------------------------------------------------------------- /Day 58 Bootstrap/TinDog Start Here/images/iphone6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 58 Bootstrap/TinDog Start Here/images/iphone6.png -------------------------------------------------------------------------------- /Day 58 Bootstrap/TinDog Start Here/images/lady-img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 58 Bootstrap/TinDog Start Here/images/lady-img.jpg -------------------------------------------------------------------------------- /Day 58 Bootstrap/TinDog Start Here/images/mashable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 58 Bootstrap/TinDog Start Here/images/mashable.png -------------------------------------------------------------------------------- /Day 58 Bootstrap/TinDog Start Here/images/tnw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 58 Bootstrap/TinDog Start Here/images/tnw.png -------------------------------------------------------------------------------- /Day 59 Updating Blog App/README.md: -------------------------------------------------------------------------------- 1 | Flask Blog App 2 | -------------------------------------------------------------------------------- /Day 59 Updating Blog App/main.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template 2 | import requests 3 | 4 | posts = requests.get("https://api.npoint.io/97b20ea528d6223a4817").json() 5 | app = Flask(__name__) 6 | 7 | 8 | @app.route('/') 9 | def get_all_posts(): 10 | return render_template("index.html", all_posts=posts) 11 | 12 | 13 | @app.route("/about") 14 | def about(): 15 | return render_template("about.html") 16 | 17 | 18 | @app.route("/contact") 19 | def contact(): 20 | return render_template("contact.html") 21 | 22 | @app.route("/post/") 23 | def show_post(index): 24 | requested_post = None 25 | for blog_post in posts: 26 | if blog_post["id"] == index: 27 | requested_post = blog_post 28 | return render_template("post.html", post=requested_post) 29 | 30 | if __name__ == "__main__": 31 | app.run(debug=True) -------------------------------------------------------------------------------- /Day 59 Updating Blog App/static/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 59 Updating Blog App/static/assets/favicon.ico -------------------------------------------------------------------------------- /Day 59 Updating Blog App/static/assets/img/about-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 59 Updating Blog App/static/assets/img/about-bg.jpg -------------------------------------------------------------------------------- /Day 59 Updating Blog App/static/assets/img/contact-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 59 Updating Blog App/static/assets/img/contact-bg.jpg -------------------------------------------------------------------------------- /Day 59 Updating Blog App/static/assets/img/home-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 59 Updating Blog App/static/assets/img/home-bg.jpg -------------------------------------------------------------------------------- /Day 59 Updating Blog App/static/assets/img/post-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 59 Updating Blog App/static/assets/img/post-bg.jpg -------------------------------------------------------------------------------- /Day 59 Updating Blog App/static/assets/img/post-sample-image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 59 Updating Blog App/static/assets/img/post-sample-image.jpg -------------------------------------------------------------------------------- /Day 59 Updating Blog App/static/js/scripts.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Start Bootstrap - Clean Blog v6.0.5 (https://startbootstrap.com/theme/clean-blog) 3 | * Copyright 2013-2021 Start Bootstrap 4 | * Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-clean-blog/blob/master/LICENSE) 5 | */ 6 | window.addEventListener('DOMContentLoaded', () => { 7 | let scrollPos = 0; 8 | const mainNav = document.getElementById('mainNav'); 9 | const headerHeight = mainNav.clientHeight; 10 | window.addEventListener('scroll', function() { 11 | const currentTop = document.body.getBoundingClientRect().top * -1; 12 | if ( currentTop < scrollPos) { 13 | // Scrolling Up 14 | if (currentTop > 0 && mainNav.classList.contains('is-fixed')) { 15 | mainNav.classList.add('is-visible'); 16 | } else { 17 | console.log(123); 18 | mainNav.classList.remove('is-visible', 'is-fixed'); 19 | } 20 | } else { 21 | // Scrolling Down 22 | mainNav.classList.remove(['is-visible']); 23 | if (currentTop > headerHeight && !mainNav.classList.contains('is-fixed')) { 24 | mainNav.classList.add('is-fixed'); 25 | } 26 | } 27 | scrollPos = currentTop; 28 | }); 29 | }) 30 | -------------------------------------------------------------------------------- /Day 59 Updating Blog App/templates/about.html: -------------------------------------------------------------------------------- 1 | {% include "header.html" %} 2 | 3 |
4 |
5 |
6 |
7 |
8 |

About Me

9 | This is what I do. 10 |
11 |
12 |
13 |
14 |
15 | 16 |
17 |
18 |
19 |
20 |

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?

21 |

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!

22 |

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!

23 |
24 |
25 |
26 |
27 | {% include "footer.html" %} -------------------------------------------------------------------------------- /Day 59 Updating Blog App/templates/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Day 59 Updating Blog App/templates/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Prachet Blog with Flask 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Day 59 Updating Blog App/templates/index.html: -------------------------------------------------------------------------------- 1 | {% include "header.html" %} 2 | 3 | 4 |
5 |
6 |
7 |
8 |
9 |
10 |

Prachet's Blog

11 | A collection of Prachet's random musings. 12 |
13 |
14 |
15 |
16 |
17 | 18 | 19 |
20 | 21 | 22 |
23 |
24 | {% for post in all_posts %} 25 |
26 | 27 |

28 | {{post.title}} 29 |

30 |

31 | {{post.subtitle}} 32 |

33 |
34 | 37 |
38 | {% endfor %} 39 | 40 |
41 | Older Posts → 42 |
43 |
44 |
45 |
46 | 47 |
48 | 49 | {% include "footer.html" %} -------------------------------------------------------------------------------- /Day 59 Updating Blog App/templates/post.html: -------------------------------------------------------------------------------- 1 | {% include "header.html" %} 2 | 3 |
4 |
5 |
6 |
7 |
8 |
9 |

{{post.title}}

10 |

{{post.subtitle}}

11 | Posted by 12 | {{post.author}} 13 | on {{post.date}} 14 |
15 |
16 |
17 |
18 |
19 | 20 | 21 |
22 |
23 |
24 |
25 |

26 | {{post.body}} 27 |

28 |
29 |
30 |
31 |
32 | 33 | {% include "footer.html" %} -------------------------------------------------------------------------------- /Day 5: Random Password Generator.py: -------------------------------------------------------------------------------- 1 | #Link to the Project: 2 | 3 | #https://replit.com/@PrachetShah/password-generator?embed=1&output=1#main.py 4 | 5 | #Code: 6 | #Password Generator Project 7 | import random 8 | letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] 9 | numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] 10 | symbols = ['!', '#', '$', '%', '&', '(', ')', '*', '+'] 11 | hard = letters + numbers + symbols 12 | 13 | print("Welcome to the PyPassword Generator!") 14 | nr_letters= int(input("How many letters would you like in your password?\n")) 15 | nr_symbols = int(input(f"How many symbols would you like?\n")) 16 | nr_numbers = int(input(f"How many numbers would you like?\n")) 17 | 18 | 19 | password_list = [] 20 | for char in range(1,nr_letters+1): 21 | password_list.append(random.choice(letters)) 22 | 23 | for char in range(1,nr_symbols+1): 24 | password_list += random.choice(symbols) 25 | 26 | for char in range(1,nr_numbers + 1): 27 | password_list += random.choice(numbers) 28 | 29 | password = '' 30 | random.shuffle(password_list) 31 | for char in password_list: 32 | password += char 33 | print(f"Your password is {password}") 34 | -------------------------------------------------------------------------------- /Day 60 Adding Functionality to HTML Forms with Flask Request/README.md: -------------------------------------------------------------------------------- 1 | Form Functionality 2 | -------------------------------------------------------------------------------- /Day 60 Adding Functionality to HTML Forms with Flask Request/main.py: -------------------------------------------------------------------------------- 1 | from flask import Flask,render_template,request 2 | app = Flask(__name__) 3 | 4 | @app.route('/') 5 | def hello(): 6 | return render_template("index.html") 7 | 8 | @app.route('/login', methods=["GET","POST"]) 9 | def receive_data(): 10 | return f"

Name: {request.form['username']} and Pass: {request.form['password']}

" 11 | 12 | if __name__ == "__main__": 13 | app.run(debug=True) -------------------------------------------------------------------------------- /Day 60 Adding Functionality to HTML Forms with Flask Request/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | HTML Forms 8 | 9 | 10 | 11 | 12 | 13 |

It Works

14 |
15 |
16 | 17 | 18 | 19 | 20 | 21 |
22 |
23 | 24 | -------------------------------------------------------------------------------- /Day 61 Flask-WTForms/README.md: -------------------------------------------------------------------------------- 1 | Flask-WTForm with Bootstrap Template 2 | -------------------------------------------------------------------------------- /Day 61 Flask-WTForms/main.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template 2 | from flask_wtf import FlaskForm 3 | from wtforms import StringField, PasswordField, SubmitField 4 | from wtforms.validators import DataRequired, Email, Length 5 | from flask_bootstrap import Bootstrap 6 | 7 | #Create a Flask Form 8 | class LoginForm(FlaskForm): 9 | email = StringField(label='Email', validators=[DataRequired(), Email()]) 10 | password = PasswordField(label='Password', validators=[DataRequired(), Length(min=8)]) 11 | submit = SubmitField(label="Log In") 12 | 13 | 14 | app = Flask(__name__) 15 | app.secret_key = "python-is-love" 16 | Bootstrap(app) 17 | 18 | 19 | @app.route("/") 20 | def home(): 21 | return render_template("index.html") 22 | 23 | 24 | @app.route("/login", methods=["GET", "POST"]) 25 | def login(): 26 | login_form = LoginForm() 27 | if login_form.validate_on_submit(): 28 | if login_form.email.data == "admin@email.com" and login_form.password.data == "12345678": 29 | return render_template("success.html") 30 | else: 31 | return render_template("denied.html") 32 | return render_template("login.html", form=login_form) 33 | 34 | 35 | if __name__ == '__main__': 36 | app.run(debug=True) 37 | -------------------------------------------------------------------------------- /Day 61 Flask-WTForms/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==1.0.2 2 | flask 3 | 4 | WTForms~=2.3.3 -------------------------------------------------------------------------------- /Day 61 Flask-WTForms/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {% block title %}{% endblock %} 6 | 13 | 14 | 15 | {% block content %}{% endblock %} 16 | 17 | -------------------------------------------------------------------------------- /Day 61 Flask-WTForms/templates/denied.html: -------------------------------------------------------------------------------- 1 | {% extends 'bootstrap/base.html' %} 2 | 3 | {% block title %} 4 | Access Denied 5 | {% endblock %} 6 | 7 | {% block content %} 8 |
9 |

Access Denied

10 |

via GIPHY

11 |
12 | {% endblock %} -------------------------------------------------------------------------------- /Day 61 Flask-WTForms/templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'bootstrap/base.html' %} 2 | 3 | {% block title %} 4 | Secrets 5 | {% endblock %} 6 | 7 | {% block content %} 8 | 9 |
10 |
11 |

Welcome

12 |

Are you ready to discover my secret?

13 | Login 14 |
15 |
16 | {% endblock %} -------------------------------------------------------------------------------- /Day 61 Flask-WTForms/templates/login.html: -------------------------------------------------------------------------------- 1 | {% extends 'bootstrap/base.html' %} 2 | {% import "bootstrap/wtf.html" as wtf %} 3 | 4 | {% block title %} 5 | Login 6 | {% endblock %} 7 | 8 | {% block content %} 9 |
10 |

Login

11 | {{ wtf.quick_form(form) }} 12 |
13 | {% endblock %} -------------------------------------------------------------------------------- /Day 61 Flask-WTForms/templates/success.html: -------------------------------------------------------------------------------- 1 | {% extends 'bootstrap/base.html' %} 2 | 3 | {% block title %} 4 | Login 5 | {% endblock %} 6 | 7 | {% block content %} 8 |
9 |

Top Secret

10 |

via GIPHY

11 |
12 | {% endblock %} -------------------------------------------------------------------------------- /Day 62 Flask Bootstrap CSS/README.md: -------------------------------------------------------------------------------- 1 | FlaskBootstrap CSS 2 | -------------------------------------------------------------------------------- /Day 62 Flask Bootstrap CSS/cafe-data.csv: -------------------------------------------------------------------------------- 1 | Cafe Name,Location,Open,Close,Coffee,Wifi,Power 2 | Lighthaus,https://goo.gl/maps/2EvhB4oq4gyUXKXx9,11AM, 3:30PM,☕☕☕☕️,💪💪,🔌🔌🔌 3 | Esters,https://goo.gl/maps/13Tjc36HuPWLELaSA,8AM,3PM,☕☕☕☕,💪💪💪,🔌 4 | Ginger & White,https://goo.gl/maps/DqMx2g5LiAqv3pJQ9,7:30AM,5:30PM,☕☕☕,✘,🔌 5 | Mare Street Market,https://goo.gl/maps/ALR8iBiNN6tVfuAA8,8AM,1PM,☕☕,💪💪💪,🔌🔌🔌 6 | Angela's Cafe,https://www.fjlkjlksdjfsdf.com,9AM,5PM,☕☕☕☕☕,💪💪💪,🔌🔌 7 | sdfsdf,https://www.fjlkjlksdjfsdf.com,sdfsdf,sdfsdf,☕️,✘,✘ -------------------------------------------------------------------------------- /Day 62 Flask Bootstrap CSS/main.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, redirect, url_for 2 | from flask_bootstrap import Bootstrap 3 | from flask_wtf import FlaskForm 4 | from wtforms import StringField, SubmitField, SelectField 5 | from wtforms.validators import DataRequired, URL 6 | import csv 7 | 8 | app = Flask(__name__) 9 | app.config['SECRET_KEY'] = '8BYkEfBA6O6donzWlSihBXox7C0sKR6b' 10 | Bootstrap(app) 11 | 12 | 13 | class CafeForm(FlaskForm): 14 | cafe = StringField('Cafe name', validators=[DataRequired()]) 15 | location = StringField("Cafe Location on Google Maps (URL)", validators=[DataRequired(), URL()]) 16 | open = StringField("Opening Time e.g. 8AM", validators=[DataRequired()]) 17 | close = StringField("Closing Time e.g. 5:30PM", validators=[DataRequired()]) 18 | coffee_rating = SelectField("Coffee Rating", choices=["☕️", "☕☕", "☕☕☕", "☕☕☕☕", "☕☕☕☕☕"], validators=[DataRequired()]) 19 | wifi_rating = SelectField("Wifi Strength Rating", choices=["✘", "💪", "💪💪", "💪💪💪", "💪💪💪💪", "💪💪💪💪💪"], validators=[DataRequired()]) 20 | power_rating = SelectField("Power Socket Availability", choices=["✘", "🔌", "🔌🔌", "🔌🔌🔌", "🔌🔌🔌🔌", "🔌🔌🔌🔌🔌"], validators=[DataRequired()]) 21 | submit = SubmitField('Submit') 22 | 23 | 24 | @app.route("/") 25 | def home(): 26 | return render_template("index.html") 27 | 28 | 29 | @app.route('/add', methods=["GET", "POST"]) 30 | def add_cafe(): 31 | form = CafeForm() 32 | if form.validate_on_submit(): 33 | with open("cafe-data.csv", mode="a") as csv_file: 34 | csv_file.write(f"\n{form.cafe.data}," 35 | f"{form.location.data}," 36 | f"{form.open.data}," 37 | f"{form.close.data}," 38 | f"{form.coffee_rating.data}," 39 | f"{form.wifi_rating.data}," 40 | f"{form.power_rating.data}") 41 | return redirect(url_for('cafes')) 42 | return render_template('add.html', form=form) 43 | 44 | 45 | @app.route('/cafes') 46 | def cafes(): 47 | with open('cafe-data.csv', newline='') as csv_file: 48 | csv_data = csv.reader(csv_file, delimiter=',') 49 | list_of_rows = [] 50 | for row in csv_data: 51 | list_of_rows.append(row) 52 | return render_template('cafes.html', cafes=list_of_rows) 53 | 54 | 55 | if __name__ == '__main__': 56 | app.run(debug=True) 57 | -------------------------------------------------------------------------------- /Day 62 Flask Bootstrap CSS/requirements.txt: -------------------------------------------------------------------------------- 1 | click==7.1.2 2 | dominate==2.5.2 3 | Flask==1.1.2 4 | Flask-Bootstrap==3.3.7.1 5 | Flask-WTF==0.14.3 6 | itsdangerous==1.1.0 7 | Jinja2==2.11.2 8 | MarkupSafe==1.1.1 9 | visitor==0.1.3 10 | Werkzeug==1.0.1 11 | WTForms==2.3.3 12 | -------------------------------------------------------------------------------- /Day 62 Flask Bootstrap CSS/static/css/styles.css: -------------------------------------------------------------------------------- 1 | /* to override Bootstrap styles for some things */ 2 | 3 | body { 4 | background-color: #333; 5 | color: white; 6 | } 7 | 8 | a { 9 | color: #ffc107; 10 | } 11 | 12 | .jumbotron { 13 | display: flex; 14 | align-items: center; 15 | margin: 0; 16 | height: 100vh; 17 | color: white; 18 | background-color: #333; 19 | } 20 | 21 | .space-above { 22 | margin-top: 20px; 23 | padding-top: 20px; 24 | } 25 | -------------------------------------------------------------------------------- /Day 62 Flask Bootstrap CSS/templates/add.html: -------------------------------------------------------------------------------- 1 | {% extends 'bootstrap/base.html' %} 2 | {% import "bootstrap/wtf.html" as wtf %} 3 | 4 | {% block styles %} 5 | {{ super() }} 6 | 7 | {% endblock %} 8 | 9 | 10 | {% block title %}Add A New Cafe{% endblock %} 11 | 12 | 13 | {% block content %} 14 |
15 |
16 |
17 | 18 |

Add a new cafe into the database

19 | 20 | {{ wtf.quick_form(form, novalidate=True) }} 21 | 22 |

See all cafes

23 | 24 |
25 |
26 |
27 | 28 | {% endblock %} 29 | -------------------------------------------------------------------------------- /Day 62 Flask Bootstrap CSS/templates/cafes.html: -------------------------------------------------------------------------------- 1 | {% extends 'bootstrap/base.html' %} 2 | 3 | {% block styles %} 4 | {{ super() }} 5 | 6 | {% endblock %} 7 | 8 | 9 | {% block title %}All Cafes{% endblock %} 10 | 11 | 12 | {% block content %} 13 | 14 |
15 |
16 |
17 | 18 |

All Cafes

19 | 20 | 21 | 22 | {% for row in cafes %} 23 | 24 | {% for item in row %} 25 | {% if item[0:4] == "http" %} 26 | 27 | {% else %} 28 | 29 | {% endif %} 30 | {% endfor %} 31 | 32 | {% endfor %} 33 |
Maps Link{{ item }}
34 |

Return to index page

35 | 36 |
37 |
38 |
39 | 40 | {% endblock %} 41 | -------------------------------------------------------------------------------- /Day 62 Flask Bootstrap CSS/templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'bootstrap/base.html' %} 2 | 3 | {% block styles %} 4 | 5 | {{ super() }} 6 | 7 | {% endblock %} 8 | 9 | 10 | {% block title %}Coffee and Wifi{% endblock %} 11 | 12 | 13 | {% block content %} 14 |
15 |
16 |

☕️ Coffee & Wifi 💻

17 |

Want to work in a cafe but need power and wifi?

18 |
19 |

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 |
22 |
23 | 24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /Day 63 Databases and with SQLite and SQLAlchemy/README.md: -------------------------------------------------------------------------------- 1 | Started Learning Databases 2 | -------------------------------------------------------------------------------- /Day 63 Databases and with SQLite and SQLAlchemy/books.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 63 Databases and with SQLite and SQLAlchemy/books.db -------------------------------------------------------------------------------- /Day 63 Databases and with SQLite and SQLAlchemy/main.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, request, redirect, url_for 2 | from flask_sqlalchemy import SQLAlchemy 3 | 4 | from flask import Flask, render_template, request, redirect, url_for 5 | from flask_sqlalchemy import SQLAlchemy 6 | 7 | app = Flask(__name__) 8 | 9 | ##CREATE DATABASE 10 | app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///books.db" 11 | # Optional: But it will silence the deprecation warning in the console. 12 | app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False 13 | db = SQLAlchemy(app) 14 | 15 | 16 | ##CREATE TABLE 17 | class Book(db.Model): 18 | id = db.Column(db.Integer, primary_key=True) 19 | title = db.Column(db.String(250), unique=True, nullable=False) 20 | author = db.Column(db.String(250), nullable=False) 21 | rating = db.Column(db.Float, nullable=False) 22 | 23 | 24 | db.create_all() 25 | 26 | @app.route('/') 27 | def home(): 28 | ##READ ALL RECORDS 29 | all_books = db.session.query(Book).all() 30 | return render_template("index.html", books=all_books) 31 | 32 | @app.route("/add", methods=["GET", "POST"]) 33 | def add(): 34 | if request.method == "POST": 35 | # CREATE RECORD 36 | new_book = Book( 37 | title=request.form["title"], 38 | author=request.form["author"], 39 | rating=request.form["rating"] 40 | ) 41 | db.session.add(new_book) 42 | db.session.commit() 43 | return redirect(url_for('home')) 44 | return render_template("add.html") 45 | 46 | @app.route("/edit", methods=["GET", "POST"]) 47 | def edit(): 48 | if request.method == "POST": 49 | #UPDATE RECORD 50 | book_id = request.form["id"] 51 | book_to_update = Book.query.get(book_id) 52 | book_to_update.rating = request.form["rating"] 53 | db.session.commit() 54 | return redirect(url_for('home')) 55 | book_id = request.args.get('id') 56 | book_selected = Book.query.get(book_id) 57 | return render_template("edit_rating.html", book=book_selected) 58 | 59 | @app.route("/delete") 60 | def delete(): 61 | book_id = request.args.get('id') 62 | 63 | # DELETE a Record 64 | book_to_delete = Book.query.get(boot_id) 65 | db.session.delete(book_to_delete) 66 | db.session.commit() 67 | return redirect(url_for('home')) 68 | 69 | if __name__ == "__main__": 70 | app.run(debug=True) -------------------------------------------------------------------------------- /Day 63 Databases and with SQLite and SQLAlchemy/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==1.0.2 2 | flask 3 | -------------------------------------------------------------------------------- /Day 63 Databases and with SQLite and SQLAlchemy/templates/add.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Add Book 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | -------------------------------------------------------------------------------- /Day 63 Databases and with SQLite and SQLAlchemy/templates/edit_rating.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Edit Rating 6 | 7 | 8 |
9 |

Book Name: {{book.title}}

10 |

Current Rating {{book.rating}}

11 | 12 | 13 | 14 |
15 | 16 | -------------------------------------------------------------------------------- /Day 63 Databases and with SQLite and SQLAlchemy/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Library 6 | 7 | 8 |

My Library

9 | {% if books == [] %} 10 |

Library is empty

11 | {% endif %} 12 |
    13 | {% for book in books %} 14 |
  • 15 | Delete 16 | {{ book.title }} - {{ book.author }} - {{ book.rating }}/10 17 | Edit Rating 18 |
  • 19 | {% endfor %} 20 |
21 | Add New Book 22 | 23 | -------------------------------------------------------------------------------- /Day 64 Top 10 Movies Website with Flask/README.md: -------------------------------------------------------------------------------- 1 | Top 10 Movies Website created using Flask 2 | -------------------------------------------------------------------------------- /Day 64 Top 10 Movies Website with Flask/main.py: -------------------------------------------------------------------------------- 1 | 2 | from flask import Flask, render_template, redirect, url_for, request 3 | from flask_bootstrap import Bootstrap 4 | from flask_sqlalchemy import SQLAlchemy 5 | from flask_wtf import FlaskForm 6 | from wtforms import StringField, SubmitField 7 | from wtforms.validators import DataRequired 8 | import requests 9 | 10 | MOVIE_DB_API_KEY = YOU_MOVIE_DB_API_KEY 11 | MOVIE_DB_SEARCH_URL = "https://api.themoviedb.org/3/search/movie" 12 | MOVIE_DB_INFO_URL = "https://api.themoviedb.org/3/movie" 13 | MOVIE_DB_IMAGE_URL = "https://image.tmdb.org/t/p/w500" 14 | 15 | app = Flask(__name__) 16 | app.config['SECRET_KEY'] = '8BYkEfBA6O6donzWlSihBXox7C0sKR6b' 17 | Bootstrap(app) 18 | 19 | ##CREATE DB 20 | app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///movies.db' 21 | app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False 22 | db = SQLAlchemy(app) 23 | 24 | 25 | ##CREATE TABLE 26 | class Movie(db.Model): 27 | id = db.Column(db.Integer, primary_key=True) 28 | title = db.Column(db.String(250), unique=True, nullable=False) 29 | year = db.Column(db.Integer, nullable=False) 30 | description = db.Column(db.String(500), nullable=False) 31 | rating = db.Column(db.Float, nullable=True) 32 | ranking = db.Column(db.Integer, nullable=True) 33 | review = db.Column(db.String(250), nullable=True) 34 | img_url = db.Column(db.String(250), nullable=False) 35 | db.create_all() 36 | 37 | 38 | class FindMovieForm(FlaskForm): 39 | title = StringField("Movie Title", validators=[DataRequired()]) 40 | submit = SubmitField("Add Movie") 41 | 42 | 43 | class RateMovieForm(FlaskForm): 44 | rating = StringField("Your Rating Out of 10 e.g. 7.5") 45 | review = StringField("Your Review") 46 | submit = SubmitField("Done") 47 | 48 | 49 | @app.route("/") 50 | def home(): 51 | all_movies = Movie.query.order_by(Movie.rating).all() 52 | for i in range(len(all_movies)): 53 | all_movies[i].ranking = len(all_movies) - i 54 | db.session.commit() 55 | return render_template("index.html", movies=all_movies) 56 | 57 | 58 | @app.route("/add", methods=["GET", "POST"]) 59 | def add_movie(): 60 | form = FindMovieForm() 61 | if form.validate_on_submit(): 62 | movie_title = form.title.data 63 | 64 | response = requests.get(MOVIE_DB_SEARCH_URL, params={"api_key": MOVIE_DB_API_KEY, "query": movie_title}) 65 | data = response.json()["results"] 66 | return render_template("select.html", options=data) 67 | return render_template("add.html", form=form) 68 | 69 | 70 | @app.route("/find") 71 | def find_movie(): 72 | movie_api_id = request.args.get("id") 73 | if movie_api_id: 74 | movie_api_url = f"{MOVIE_DB_INFO_URL}/{movie_api_id}" 75 | response = requests.get(movie_api_url, params={"api_key": MOVIE_DB_API_KEY, "language": "en-US"}) 76 | data = response.json() 77 | new_movie = Movie( 78 | title=data["title"], 79 | year=data["release_date"].split("-")[0], 80 | img_url=f"{MOVIE_DB_IMAGE_URL}{data['poster_path']}", 81 | description=data["overview"] 82 | ) 83 | db.session.add(new_movie) 84 | db.session.commit() 85 | return redirect(url_for("rate_movie", id=new_movie.id)) 86 | 87 | 88 | @app.route("/edit", methods=["GET", "POST"]) 89 | def rate_movie(): 90 | form = RateMovieForm() 91 | movie_id = request.args.get("id") 92 | movie = Movie.query.get(movie_id) 93 | if form.validate_on_submit(): 94 | movie.rating = float(form.rating.data) 95 | movie.review = form.review.data 96 | db.session.commit() 97 | return redirect(url_for('home')) 98 | return render_template("edit.html", movie=movie, form=form) 99 | 100 | 101 | @app.route("/delete") 102 | def delete_movie(): 103 | movie_id = request.args.get("id") 104 | movie = Movie.query.get(movie_id) 105 | db.session.delete(movie) 106 | db.session.commit() 107 | return redirect(url_for("home")) 108 | 109 | 110 | if __name__ == '__main__': 111 | app.run(debug=True) 112 | -------------------------------------------------------------------------------- /Day 64 Top 10 Movies Website with Flask/movies.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrachetShah/Python-100DaysOfCode/29cda3db2e8d3e8140fe0b5a2b53f35d6f81190e/Day 64 Top 10 Movies Website with Flask/movies.db -------------------------------------------------------------------------------- /Day 64 Top 10 Movies Website with Flask/templates/add.html: -------------------------------------------------------------------------------- 1 | {% extends 'bootstrap/base.html' %} 2 | {% import "bootstrap/wtf.html" as wtf %} 3 | 4 | {% block styles %} 5 | {{ super() }} 6 | 7 | 8 | 9 | {% endblock %} 10 | 11 | {% block title %}Add Movie{% endblock %} 12 | 13 | {% block content %} 14 |
15 |

Add a Movie

16 | {{ wtf.quick_form(form, novalidate=True) }} 17 |
18 | {% endblock %} -------------------------------------------------------------------------------- /Day 64 Top 10 Movies Website with Flask/templates/edit.html: -------------------------------------------------------------------------------- 1 | {% extends 'bootstrap/base.html' %} 2 | {% import "bootstrap/wtf.html" as wtf %} 3 | 4 | {% block styles %} 5 | {{ super() }} 6 | 7 | 8 | 9 | {% endblock %} 10 | 11 | {% block title %}Edit Movies{% endblock %} 12 | 13 | {% block content %} 14 |
15 |

{{movie.title}}

16 |

Edit Movie Rating

17 | {{ wtf.quick_form(form, novalidate=True) }} 18 |
19 | {% endblock %} -------------------------------------------------------------------------------- /Day 64 Top 10 Movies Website with Flask/templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'bootstrap/base.html' %} 2 | 3 | {% block styles %} 4 | {{ super() }} 5 | 6 | 7 | 8 | 9 | 10 | {% endblock %} 11 | 12 | {% block title %}My Top 10 Movies{% endblock %} 13 | 14 | {% block content %} 15 |
16 |

My Top 10 Movies

17 |

These are my all time favourite movies.

18 | {% for movie in movies %} 19 |
20 |
21 |

{{ movie.ranking }}

22 |
23 |
24 |
25 |
{{movie.title}} ({{movie.year}})
26 |
27 | 28 | 29 |
30 |

"{{movie.review}}"

31 |

{{movie.description}}

32 | 33 | Update 34 | Delete 35 | 36 |
37 |
38 |
39 | {% endfor %} 40 |
41 |
42 | Add Movie 43 |
44 | 45 | {% endblock %} -------------------------------------------------------------------------------- /Day 64 Top 10 Movies Website with Flask/templates/select.html: -------------------------------------------------------------------------------- 1 | {% extends 'bootstrap/base.html' %} 2 | {% import "bootstrap/wtf.html" as wtf %} 3 | 4 | {% block styles %} 5 | {{ super() }} 6 | 7 | 8 | 9 | {% endblock %} 10 | 11 | {% block title %}Select Movie{% endblock %} 12 | 13 | {% block content %} 14 |
15 |

Select Movie

16 | {% for movie in options: %} 17 |

18 | {{ movie.title }} - {{movie.release_date}} 19 |

20 | {% endfor %} 21 | 22 |
23 | {% endblock %} -------------------------------------------------------------------------------- /Day 65 Design School/README.md: -------------------------------------------------------------------------------- 1 | Learned about Web Design like Color Theory, Typography, UI and UX 2 | -------------------------------------------------------------------------------- /Day 66 Building REST API/README.md: -------------------------------------------------------------------------------- 1 | Built an REST API with Postman wrapped inside Flask Server.
For Code, mail me 2 | -------------------------------------------------------------------------------- /Day 67 RESTful Blog Page/README.md: -------------------------------------------------------------------------------- 1 | Created a Blog Website which lets you Add Posts, Update Posts and Delete Posts ,Data stored in SQLAlchemy Database 2 | -------------------------------------------------------------------------------- /Day 68-70/README.md: -------------------------------------------------------------------------------- 1 | # Prachet-Blog 2 |

Blog Web Application created using Flask

3 | 4 |

Hello, this is a web app created using Flask Framework hosted on Heroku from GitHub working on gunicorn server.

5 | 6 |

Features:

7 | 8 |
    9 |
  • Secure Authentication with Hash-and-Salting Applied on passwords
  • 10 |
  • Data Stored in PostgreSQL
  • 11 |
  • Admin only changes allowed on site
  • 12 |
  • Comments can be added on Posts
  • 13 |
  • Contact Me Page and About Page
  • 14 |
  • Flask Flashcard warnings on entering incorrect Login Details 
  • 15 |
  • Redirects to Login Page when previous users tries to Register Again
  • 16 |
17 |

Website Link

18 | Blog-Site 19 | -------------------------------------------------------------------------------- /Day 6: Escaping the Maze: -------------------------------------------------------------------------------- 1 | In this project, we managed to escape the robot from the maze using while loop conditions on https://reeborg.ca/reeborg.html 2 | where various debugging concepts were taught 3 | -------------------------------------------------------------------------------- /Day 7 Hangman Project/hangman_art.py: -------------------------------------------------------------------------------- 1 | stages = [''' 2 | +---+ 3 | | | 4 | O | 5 | /|\ | 6 | / \ | 7 | | 8 | ========= 9 | ''', ''' 10 | +---+ 11 | | | 12 | O | 13 | /|\ | 14 | / | 15 | | 16 | ========= 17 | ''', ''' 18 | +---+ 19 | | | 20 | O | 21 | /|\ | 22 | | 23 | | 24 | ========= 25 | ''', ''' 26 | +---+ 27 | | | 28 | O | 29 | /| | 30 | | 31 | | 32 | =========''', ''' 33 | +---+ 34 | | | 35 | O | 36 | | | 37 | | 38 | | 39 | ========= 40 | ''', ''' 41 | +---+ 42 | | | 43 | O | 44 | | 45 | | 46 | | 47 | ========= 48 | ''', ''' 49 | +---+ 50 | | | 51 | | 52 | | 53 | | 54 | | 55 | ========= 56 | '''] 57 | 58 | logo = ''' 59 | _ 60 | | | 61 | | |__ __ _ _ __ __ _ _ __ ___ __ _ _ __ 62 | | '_ \ / _` | '_ \ / _` | '_ ` _ \ / _` | '_ \ 63 | | | | | (_| | | | | (_| | | | | | | (_| | | | | 64 | |_| |_|\__,_|_| |_|\__, |_| |_| |_|\__,_|_| |_| 65 | __/ | 66 | |___/ ''' 67 | 68 | 69 | -------------------------------------------------------------------------------- /Day 7 Hangman Project/hangman_words.py: -------------------------------------------------------------------------------- 1 | word_list = [ 2 | 'abruptly', 3 | 'absurd', 4 | 'abyss', 5 | 'affix', 6 | 'askew', 7 | 'avenue', 8 | 'awkward', 9 | 'axiom', 10 | 'azure', 11 | 'bagpipes', 12 | 'bandwagon', 13 | 'banjo', 14 | 'bayou', 15 | 'beekeeper', 16 | 'bikini', 17 | 'blitz', 18 | 'blizzard', 19 | 'boggle', 20 | 'bookworm', 21 | 'boxcar', 22 | 'boxful', 23 | 'buckaroo', 24 | 'buffalo', 25 | 'buffoon', 26 | 'buxom', 27 | 'buzzard', 28 | 'buzzing', 29 | 'buzzwords', 30 | 'caliph', 31 | 'cobweb', 32 | 'cockiness', 33 | 'croquet', 34 | 'crypt', 35 | 'curacao', 36 | 'cycle', 37 | 'daiquiri', 38 | 'dirndl', 39 | 'disavow', 40 | 'dizzying', 41 | 'duplex', 42 | 'dwarves', 43 | 'embezzle', 44 | 'equip', 45 | 'espionage', 46 | 'euouae', 47 | 'exodus', 48 | 'faking', 49 | 'fishhook', 50 | 'fixable', 51 | 'fjord', 52 | 'flapjack', 53 | 'flopping', 54 | 'fluffiness', 55 | 'flyby', 56 | 'foxglove', 57 | 'frazzled', 58 | 'frizzled', 59 | 'fuchsia', 60 | 'funny', 61 | 'gabby', 62 | 'galaxy', 63 | 'galvanize', 64 | 'gazebo', 65 | 'giaour', 66 | 'gizmo', 67 | 'glowworm', 68 | 'glyph', 69 | 'gnarly', 70 | 'gnostic', 71 | 'gossip', 72 | 'grogginess', 73 | 'haiku', 74 | 'haphazard', 75 | 'hyphen', 76 | 'iatrogenic', 77 | 'icebox', 78 | 'injury', 79 | 'ivory', 80 | 'ivy', 81 | 'jackpot', 82 | 'jaundice', 83 | 'jawbreaker', 84 | 'jaywalk', 85 | 'jazziest', 86 | 'jazzy', 87 | 'jelly', 88 | 'jigsaw', 89 | 'jinx', 90 | 'jiujitsu', 91 | 'jockey', 92 | 'jogging', 93 | 'joking', 94 | 'jovial', 95 | 'joyful', 96 | 'juicy', 97 | 'jukebox', 98 | 'jumbo', 99 | 'kayak', 100 | 'kazoo', 101 | 'keyhole', 102 | 'khaki', 103 | 'kilobyte', 104 | 'kiosk', 105 | 'kitsch', 106 | 'kiwifruit', 107 | 'klutz', 108 | 'knapsack', 109 | 'larynx', 110 | 'lengths', 111 | 'lucky', 112 | 'luxury', 113 | 'lymph', 114 | 'marquis', 115 | 'matrix', 116 | 'megahertz', 117 | 'microwave', 118 | 'mnemonic', 119 | 'mystify', 120 | 'naphtha', 121 | 'nightclub', 122 | 'nowadays', 123 | 'numbskull', 124 | 'nymph', 125 | 'onyx', 126 | 'ovary', 127 | 'oxidize', 128 | 'oxygen', 129 | 'pajama', 130 | 'peekaboo', 131 | 'phlegm', 132 | 'pixel', 133 | 'pizazz', 134 | 'pneumonia', 135 | 'polka', 136 | 'pshaw', 137 | 'psyche', 138 | 'puppy', 139 | 'puzzling', 140 | 'quartz', 141 | 'queue', 142 | 'quips', 143 | 'quixotic', 144 | 'quiz', 145 | 'quizzes', 146 | 'quorum', 147 | 'razzmatazz', 148 | 'rhubarb', 149 | 'rhythm', 150 | 'rickshaw', 151 | 'schnapps', 152 | 'scratch', 153 | 'shiv', 154 | 'snazzy', 155 | 'sphinx', 156 | 'spritz', 157 | 'squawk', 158 | 'staff', 159 | 'strength', 160 | 'strengths', 161 | 'stretch', 162 | 'stronghold', 163 | 'stymied', 164 | 'subway', 165 | 'swivel', 166 | 'syndrome', 167 | 'thriftless', 168 | 'thumbscrew', 169 | 'topaz', 170 | 'transcript', 171 | 'transgress', 172 | 'transplant', 173 | 'triphthong', 174 | 'twelfth', 175 | 'twelfths', 176 | 'unknown', 177 | 'unworthy', 178 | 'unzip', 179 | 'uptown', 180 | 'vaporize', 181 | 'vixen', 182 | 'vodka', 183 | 'voodoo', 184 | 'vortex', 185 | 'voyeurism', 186 | 'walkway', 187 | 'waltz', 188 | 'wave', 189 | 'wavy', 190 | 'waxy', 191 | 'wellspring', 192 | 'wheezy', 193 | 'whiskey', 194 | 'whizzing', 195 | 'whomever', 196 | 'wimpy', 197 | 'witchcraft', 198 | 'wizard', 199 | 'woozy', 200 | 'wristwatch', 201 | 'wyvern', 202 | 'xylophone', 203 | 'yachtsman', 204 | 'yippee', 205 | 'yoked', 206 | 'youthful', 207 | 'yummy', 208 | 'zephyr', 209 | 'zigzag', 210 | 'zigzagging', 211 | 'zilch', 212 | 'zipper', 213 | 'zodiac', 214 | 'zombie', 215 | ] -------------------------------------------------------------------------------- /Day 7 Hangman Project/main.py: -------------------------------------------------------------------------------- 1 | import random 2 | from hangman_art import stages, logo 3 | from hangman_words import word_list 4 | from replit import clear 5 | 6 | print(logo) 7 | game_is_finished = False 8 | lives = len(stages) - 1 9 | 10 | chosen_word = random.choice(word_list) 11 | word_length = len(chosen_word) 12 | 13 | display = [] 14 | for _ in range(word_length): 15 | display += "_" 16 | 17 | while not game_is_finished: 18 | guess = input("Guess a letter: ").lower() 19 | 20 | #Use the clear() function imported from replit to clear the output between guesses. 21 | clear() 22 | 23 | if guess in display: 24 | print(f"You've already guessed {guess}") 25 | 26 | for position in range(word_length): 27 | letter = chosen_word[position] 28 | if letter == guess: 29 | display[position] = letter 30 | print(f"{' '.join(display)}") 31 | 32 | if guess not in chosen_word: 33 | print(f"You guessed {guess}, that's not in the word. You lose a life.") 34 | lives -= 1 35 | if lives == 0: 36 | game_is_finished = True 37 | print("You lose.") 38 | 39 | if not "_" in display: 40 | game_is_finished = True 41 | print("You win.") 42 | 43 | print(stages[lives]) -------------------------------------------------------------------------------- /Day 71 Data Exploration with Pandas of College Major Program/README.md: -------------------------------------------------------------------------------- 1 | # Learning Points & Summary 2 | **Today's Learning Points** 3 | 4 | 5 | 6 | * Use `.head()`, `.tail()`, `.shape` and `.columns` to explore your DataFrame and find out the number of rows and columns as well as the column names. 7 | 8 | * Look for NaN (not a number) values with `.findna()` and consider using `.dropna()` to clean up your DataFrame. 9 | 10 | * You can access entire columns of a DataFrame using the square bracket notation:` df['column name']` or `df[['column name 1', 'column name 2', 'column name 3']]` 11 | 12 | * You can access individual cells in a DataFrame by chaining square brackets `df['column name'][index]` or using `df['column name'].loc[index]` 13 | 14 | * The largest and smallest values, as well as their positions, can be found with methods like `.max()`, `.min()`, `.idxmax()` and `.idxmin()` 15 | 16 | * You can sort the DataFrame with `.sort_values()` and add new columns with `.insert()` 17 | 18 | * To create an Excel Style Pivot Table by grouping entries that belong to a particular category use the `.groupby()` method 19 | -------------------------------------------------------------------------------- /Day 73 Aggregate and Merge Data with Pandas, Analysing LEGO Dataset/README.md: -------------------------------------------------------------------------------- 1 | ## Aggregate and Merge Data with Pandas, Analysing LEGO Dataset 2 | Notebook in my Data Science Repository 3 | -------------------------------------------------------------------------------- /Day 74 Resamling and Visualising Data, Working with Google Trends Data/README.md: -------------------------------------------------------------------------------- 1 | ## Resampling and Visualising Data, Working with Google Trends Data 2 | Notebook available on my Data Science Repository 3 | -------------------------------------------------------------------------------- /Day 75 Android Store Trends/README.md: -------------------------------------------------------------------------------- 1 | Data Exploration of ANdroid Store Download Data. Source code available on Data Science Repository 2 | -------------------------------------------------------------------------------- /Day 76 Computation with NumPy/README.md: -------------------------------------------------------------------------------- 1 | Full resource in my Data Science Repository 2 | -------------------------------------------------------------------------------- /Day 77 Linear Regression and Seaborn/README.md: -------------------------------------------------------------------------------- 1 | Data Exploration in my DATA SCIENCE Repository 2 | -------------------------------------------------------------------------------- /Day 78 Analyzing Nobel Prizes/README.md: -------------------------------------------------------------------------------- 1 | In my Data Science Repository 2 | -------------------------------------------------------------------------------- /Day 79 Discovery of Handwashing/README.md: -------------------------------------------------------------------------------- 1 | Full files in my DATA SCIENCE Repository 2 | -------------------------------------------------------------------------------- /Day 8 Caesar Cipher Project/art.py: -------------------------------------------------------------------------------- 1 | logo = """ 2 | ,adPPYba, ,adPPYYba, ,adPPYba, ,adPPYba, ,adPPYYba, 8b,dPPYba, 3 | a8" "" "" `Y8 a8P_____88 I8[ "" "" `Y8 88P' "Y8 4 | 8b ,adPPPPP88 8PP""""""" `"Y8ba, ,adPPPPP88 88 5 | "8a, ,aa 88, ,88 "8b, ,aa aa ]8I 88, ,88 88 6 | `"Ybbd8"' `"8bbdP"Y8 `"Ybbd8"' `"YbbdP"' `"8bbdP"Y8 88 7 | 88 88 8 | "" 88 9 | 88 10 | ,adPPYba, 88 8b,dPPYba, 88,dPPYba, ,adPPYba, 8b,dPPYba, 11 | a8" "" 88 88P' "8a 88P' "8a a8P_____88 88P' "Y8 12 | 8b 88 88 d8 88 88 8PP""""""" 88 13 | "8a, ,aa 88 88b, ,a8" 88 88 "8b, ,aa 88 14 | `"Ybbd8"' 88 88`YbbdP"' 88 88 `"Ybbd8"' 88 15 | 88 16 | 88 17 | """ -------------------------------------------------------------------------------- /Day 8 Caesar Cipher Project/main.py: -------------------------------------------------------------------------------- 1 | from art import logo 2 | print(logo) 3 | alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] 4 | 5 | def caesar(start_text, shift_amount, cipher_direction): 6 | end_text = "" 7 | if cipher_direction == "decode": 8 | shift_amount *= -1 9 | for char in start_text: 10 | 11 | if(char in alphabet): 12 | position = alphabet.index(char) 13 | new_position = position + shift_amount 14 | end_text += alphabet[new_position] 15 | else: 16 | end_text += char 17 | 18 | print(f"Here's the {cipher_direction}d result: {end_text}") 19 | 20 | print(logo) 21 | 22 | should_continue = True 23 | while should_continue: 24 | direction = input("Type 'encode' to encrypt, type 'decode' to decrypt:\n") 25 | text = input("Type your message:\n").lower() 26 | shift = int(input("Type the shift number:\n")) 27 | 28 | shift = shift % 26 29 | 30 | caesar(start_text=text, shift_amount=shift,cipher_direction=direction) 31 | result = input("Type 'yes' if you want to continue else type 'no'\n").lower() 32 | if(result == 'no'): 33 | should_continue = False 34 | print("GoodBye") 35 | -------------------------------------------------------------------------------- /Day 80 House Price Prediction/README.md: -------------------------------------------------------------------------------- 1 | Complete Notebook is available in my Data Science Repository 2 | -------------------------------------------------------------------------------- /Day 81 Text to Morse Code Converter/README.md: -------------------------------------------------------------------------------- 1 | ## Text to Morse Code Converter 2 | -------------------------------------------------------------------------------- /Day 81 Text to Morse Code Converter/main.py: -------------------------------------------------------------------------------- 1 | morse_convert = { 2 | 'A':'.-', 'B':'-...', 3 | 'C':'-.-.', 'D':'-..', 'E':'.', 4 | 'F':'..-.', 'G':'--.', 'H':'....', 5 | 'I':'..', 'J':'.---', 'K':'-.-', 6 | 'L':'.-..', 'M':'--', 'N':'-.', 7 | 'O':'---', 'P':'.--.', 'Q':'--.-', 8 | 'R':'.-.', 'S':'...', 'T':'-', 9 | 'U':'..-', 'V':'...-', 'W':'.--', 10 | 'X':'-..-', 'Y':'-.--', 'Z':'--..', 11 | '1':'.----', '2':'..---', '3':'...--', 12 | '4':'....-', '5':'.....', '6':'-....', 13 | '7':'--...', '8':'---..', '9':'----.', 14 | '0':'-----', ', ':'--..--', '.':'.-.-.-', 15 | '?':'..--..', '/':'-..-.', '-':'-....-', 16 | '(':'-.--.', ')':'-.--.-', 17 | } 18 | 19 | #Menu 20 | print('Welcome to Text to Morse Code Generator') 21 | sentence = input('Enter your sentence to convert into morse code: ') 22 | sentence = sentence.upper() 23 | print(sentence) 24 | 25 | #Conversion 26 | code = '' 27 | for char in sentence: 28 | if char == ' ': 29 | code += ' ' 30 | else: 31 | code += morse_convert[char] 32 | 33 | print(f"Your text into Morse Code is: \n{code}") -------------------------------------------------------------------------------- /Day 82 Personal Portfolio Website/README.md: -------------------------------------------------------------------------------- 1 | ## [URL](https://prachetshah.netlify.app/) 2 | -------------------------------------------------------------------------------- /Day 83 Tic Tac Toe/README.md: -------------------------------------------------------------------------------- 1 | Tic Tac Toe Project 2 | -------------------------------------------------------------------------------- /Day 84 Watermarking App/README.md: -------------------------------------------------------------------------------- 1 | Watermarking GUI App 2 | -------------------------------------------------------------------------------- /Day 9 Blind Auction Project/Readme.md: -------------------------------------------------------------------------------- 1 | Blind Auction Project in which concepts of nesting and dictionaries are used to create a bidding program 2 | Link to the Application : 3 | https://replit.com/@PrachetShah/blind-auction?embed=0&output=0#main.py 4 | -------------------------------------------------------------------------------- /Day 9 Blind Auction Project/art.py: -------------------------------------------------------------------------------- 1 | logo = ''' 2 | ___________ 3 | \ / 4 | )_______( 5 | |"""""""|_.-._,.---------.,_.-._ 6 | | | | | | | ''-. 7 | | |_| |_ _| |_..-' 8 | |_______| '-' `'---------'` '-' 9 | )"""""""( 10 | /_________\\ 11 | .-------------. 12 | /_______________\\ 13 | ''' -------------------------------------------------------------------------------- /Day 9 Blind Auction Project/main.py: -------------------------------------------------------------------------------- 1 | from replit import clear 2 | #HINT: You can call clear() to clear the output in the console. 3 | from art import logo 4 | print(logo) 5 | print("Welcome to Blind Auction") 6 | bidders_list = {} 7 | 8 | flag = True 9 | #Game Loop 10 | while(flag): 11 | name = input("Enter your name :") 12 | bidders_list[name] = int(input("Enter your Bid : $")) 13 | response = input("Type Yes if there are any other bidders else type No :").lower() 14 | if(response == "no"): 15 | flag = False 16 | clear() 17 | 18 | 19 | def highest_bidder(bidders_list): 20 | max_bidder = "Noone" 21 | max_amount = 0 22 | for bidder in bidders_list: 23 | if(bidders_list[bidder] > max_amount): 24 | max_bidder = bidder 25 | max_amount = bidders_list[bidder] 26 | 27 | print(f"The winner is {max_bidder} with a maximum bid of ${max_amount}") 28 | 29 | highest_bidder(bidders_list) 30 | 31 | --------------------------------------------------------------------------------