Posts

Showing posts from February, 2022

INDIAN FLAG USING PYTHON

 SOUREC CODE: import turtle from turtle import* #screen for output screen = turtle.Screen() # Defining a turtle Instance t = turtle.Turtle() speed(0) # initially penup() t.penup() t.goto(-400, 250) t.pendown() # Orange Rectangle #white rectangle t.color("orange") t.begin_fill() t.forward(800) t.right(90) t.forward(167) t.right(90) t.forward(800) t.end_fill() t.left(90) t.forward(167) # Green Rectangle t.color("green") t.begin_fill() t.forward(167) t.left(90) t.forward(800) t.left(90) t.forward(167) t.end_fill() # Big Blue Circle t.penup() t.goto(70, 0) t.pendown() t.color("navy") t.begin_fill() t.circle(70) t.end_fill() # Big White Circle t.penup() t.goto(60, 0) t.pendown() t.color("white") t.begin_fill() t.circle(60) t.end_fill() # Mini Blue Circles t.penup() t.goto(-57, -8) t.pendown() t.color("navy") for i in range(24): t.begin_fill() t.circle(3) t.end_fill() t.penup() t.forward(15) t.right(15) t.pendown() # Small Blu

SUPER STAR IN PYTHON

 SOUCE CODE : import turtle a=turtle.Turtle() a.getscreen().bgcolor( "black" ) a.penup() a.goto(- 200 , 100 ) a.pendown() a.color( "yellow" ) a.speed( 25 ) def star ( turtle , size ):     if size<= 10 :         return     else :         turtle.begin_fill()         for i in range ( 5 ):             turtle.pensize( 2 )             turtle.forward(size)             star(turtle, size/ 3 )             turtle.left( 216 )             turtle.end_fill() star(a, 360 ) turtle.done()

TEXT TO SPEECH FRIEND

 HEY... THIS IS A CODE TO MAKE COMPUTER SPEAK YOUR TEXT.. YOU WILL HAVE TO INSTALL SOME MODULES  MAKE SURE THAT BEFORE CREATING THIS PROJECT YOU HAVE INSTALLED THESE TWO MODULES BY USING PIP OR ELSE. pyttsx3 and speech_recognition SOURCE CODE: import pyttsx3 import speech_recognition as sr friend = pyttsx3.init() speech = input ( "Say Something: " ) friend.say(speech) friend.runAndWait()

STAR USING TURTLE GRAPHICS

 DRAW A STAR USING TURTLE GRAPHICS  SOURE CODE: import turtle sc=turtle.Screen() sc.setup( 600 , 600 ) spiral=turtle.Turtle() spiral.speed( 10 ) sc.bgcolor( "black" ) col = ( "cyan" , "blue" , "yellow" , "green" ) c= 0 for i in range ( 110 ):     spiral.pensize( 2 )     spiral.forward(i* 5 )     spiral.right( 144 )     spiral.color(col[c])     if c== 3 :        c= 0     else :        c+= 1

SNAKE GAME BY AVI

 MAKE SNAKE GAME USING PYTHON  WITH JUST FEW LINES OF CODES  CREDIT: AVI  SOURCE CODE: import pygame import time import random pygame.init() white = ( 255 , 255 , 255 ) yellow = ( 255 , 255 , 102 ) black = ( 0 , 0 , 0 ) red = ( 213 , 50 , 80 ) green = ( 0 , 255 , 0 ) blue = ( 50 , 153 , 213 ) dis_width = 800 dis_height = 600 dis = pygame.display.set_mode((dis_width, dis_height)) pygame.display.set_caption( 'Snake Game by Avi' ) clock = pygame.time.Clock() snake_block = 10 snake_speed = 10 font_style = pygame.font.SysFont( "bahnschrift" , 25 ) score_font = pygame.font.SysFont( "comicsansms" , 35 ) def Your_score ( score ):     value = score_font.render( "Your Score: " + str (score), True , yellow)     dis.blit(value, [ 0 , 0 ]) def our_snake ( snake_block , snake_list ):     for x in snake_list:         pygame.draw.rect(dis, black, [x[ 0 ], x[ 1 ], snake_block, snake_block]) def message ( msg , color ):     mesg = font_style.render(msg, Tru

DORA.PY

DRAW DOREAMON USING PYTHON.... BY AVI.... SOURCE CODE : from turtle import * def my_goto ( x , y ):     penup()     goto(x, y)     pendown() def eyes ():     fillcolor( "#ffffff" )     begin_fill()     tracer( False )     a = 2.5     for i in range ( 120 ):         if 0 <= i < 30 or 60 <= i < 90 :             a -= 0.05             lt( 3 )             fd(a)         else :             a += 0.05             lt( 3 )             fd(a)     tracer( True )     end_fill() def beard ():     my_goto(- 32 , 135 )     seth( 165 )     fd( 60 )     my_goto(- 32 , 125 )     seth( 180 )     fd( 60 )     my_goto(- 32 , 115 )     seth( 193 )     fd( 60 )     my_goto( 37 , 135 )     seth( 15 )     fd( 60 )     my_goto( 37 , 125 )     seth( 0 )     fd( 60 )     my_goto( 37 , 115 )     seth(- 13 )     fd( 60 ) def mouth ():     my_goto( 5 , 148 )     seth( 270 )     fd( 100 )     seth( 0 )     circle( 120 , 50 )     seth( 230 )     circle(- 120 , 100 ) def scarf ():     f