Posts

Just A Really Very Intelligent System with Python

Image
Yesterday while watching YouTube I saw a video in which Iron Man was talking to JARVIS, I thought that if Tony Stark can do it, why not me? At last I am also a programmer. So here I am after making JARVIS using Python. Source Code: import pyttsx3 import speech_recognition as sr import wikipedia import webbrowser import os # init pyttsx engine = pyttsx3.init("sapi5") voices = engine.getProperty("voices") engine.setProperty('voice', voices[1].id) # 1 for female and 0 for male voice def speak(audio): engine.say(audio) engine.runAndWait() def take_command(): r = sr.Recognizer() with sr.Microphone() as source: print("Listening...") r.pause_threshold = 1 audio = r.listen(source) try: print("Recognizing...") query = r.recognize_google(audio, language='en-in') print("User said:" + query + "\n") except Exception as e: print(e)

Ads Blocker with Python

Image
Aren’t we all tired of random pop-ups during site surfing? So, we can create website blockers for restraining pushy ads by creating this Python project. Remember, when you code this, you can add the sites you need to block by editing sites_to_block, change the host, or edit the time when you need to block the site  Source Code: import time from datetime import datetime as dt sites_to_block = [ "www.linkdin.com", "facebook.com", "www.youtube.com", "youtube.com", "www.google.com", "google.com", ] Linux_host = "/etc/hosts" Window_host = r"C:\Windows\System32\drivers\etc\hosts" default_hoster = Linux_host redirect = "127.0.0.1" print("CodeWithAditya") def block_websites(start_hour, end_hour): while True: if ( dt(dt.now().year, dt.now().month, dt.now().day, start_hour) < dt.now() < dt(dt.now().year, dt.now().mon

Making a ChatBot in python using NLTK

Image
What is a Chatbot A chatbot is a smart application that reduces human work and helps an organization to solve basic queries of the customer. Today most of the companies, business from different sector makes use of chatbot in a different way to reply their customer as fast as possible. chatbots also help in increasing traffic of site which is top reason of business to use chatbots. Chatbot asks for basic information of customers like name, email address, and the query. If a query is simple like product fault, booking mistake, need some information then without any human connection it can solve it automatically and If some problem is high then It passes the details to the human head and helps customer to connect with organization manager easily. And most of the customers like to deal and talk with a chatbot.  Source Code: def greet(bot_name, birth_year): print 'Hello! My name is {0}.'.format(bot_name) print 'I was created in {0}.'.format(birth_year) def remind

Game of SIM with Python Turtle

Image
Game of SIM was invented in 1969 by Gustavus Simmons. In this two player (red and blue) game, each player takes turn to connect two vertices of a hexagon with the player’s color (either red or blue). The first player who draws all three sides of the triangle with the player’s color loses the game. There is always a winner for this game. Write a Game of SIM with Python and Turtle graphics. Your game should be able to declare the winner when the game ends. You will need to use  onclick()  even of Turtle graphics. Source Code: import turtle import math screen = turtle.Screen() screen.setup(800,800) screen.title("Game of SIM - CodeWithAditya") screen.setworldcoordinates(-1.5,-1.5,1.5,1.5) screen.tracer(0,0) turtle.hideturtle() def draw_dot(x,y,color): turtle.up() turtle.goto(x,y) turtle.color(color) turtle.dot(15) def gen_dots(): r = [] for angle in range(0,360,60): r.append((math.cos(math.radians(angle)),math.sin(math.radians(angle)))) retu

Python Tic Tac Toe

Image
  It’s no doubt, you must have played Tic Tac Toe in your school days and every one of us loves to play the game. You will be surprised to know that the game of Tic Tac Toe is known to exist since ancient Egypt times. With this Python project by CodeWithAditya, we are going to build an interactive game of Tic Tac Toe where we’ll learn new things along the way. What is Tic Tac Toe? Tic Tac Toe is one of the most played games and is the best time killer game that you can play anywhere with just a pen and paper. If you don’t know how to play this game don’t worry let us first understand that. Source Code: theBoard = { '7': ' ', '8': ' ', '9': ' ', '4': ' ', '5': ' ', '6': ' ', '1': ' ', '2': ' ', '3': ' ', } board_keys = [] for key in theBoard: board_keys.append(key) def printBoard(board): print