Posts

Showing posts from August, 2021

Mad Libs Generator using Python

  This python beginner project is a good start for beginner software developers as it has concepts like strings, variables, and concatenation. Mad Libs Generator teaches to manipulate user-inputted data as the Mad Libs refer to a series of inputs that a user enters. The input from the user could be anything from an adjective, a pronoun, or even a verb. After all the inputs are entered the application takes all the data and arranges it to build a story template.  Here is the Source Code👇 """ Mad Libs Generator ---------------------------------------- """ #Loop back to this point once code finishes loop = 1 while (loop < 10): #All the questions that the program asks the user     noun = input("Choose a noun: ")     p_noun = input("Choose a plural noun: ")     noun2 = input("Choose a noun: ")     place = input("Name a place: ")     adjective = input("Choose an adjective (Describing word): ")     noun3 = inp...

Draw Indian Flag using Python turtle

Image
  Source Code:- # required module-pip install turtle import turtle # inializing a turtle flag = turtle.Turtle() turtle.bgcolor("black") # for creating first reactangle flag.begin_fill() flag.fillcolor("orange") flag.forward(500) flag.right(90) flag.forward(100) flag.right(90) flag.forward(500) flag.right(90) flag.forward(100) flag.right(90) flag.end_fill() # for second rectangle flag.right(90) flag.forward(100) flag.begin_fill() flag.fillcolor("white") flag.forward(100) flag.left(90) flag.forward(500) flag.left(90) flag.forward(100) flag.left(90) flag.forward(500) flag.end_fill() # for third rectangle flag.begin_fill() flag.fillcolor("green") flag.left(90) flag.forward(200) flag.left(90) flag.forward(500) flag.left(90) flag.forward(100) flag.left(90) flag.forward(500) flag.end_fill() #big blue circle flag.penup() flag.setpos(250,-105) flag.pendown() flag.begin_fill() flag.fillcolor("navy") flag.circle(45) flag.end_fill() #big white circ...

Python Program for Tower of Hanoi

Image
 Tower of Hanoi is a mathematical puzzle where we have three rods and n disks. The objective of the puzzle is to move the entire stack to another rod, obeying the following simple rules:  1) Only one disk can be moved at a time.  2) Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack i.e. a disk can only be moved if it is the uppermost disk on a stack.  3) No disk may be placed on top of a smaller disk. Source Code:- # Recursive Python function to solve the tower of hanoi def TowerOfHanoi(n , source, destination, auxiliary):     if n==1:         print "Move disk 1 from source",source,"to destination",destination         return     TowerOfHanoi(n-1, source, auxiliary, destination)     print "Move disk",n,"from source",source,"to destination",destination     TowerOfHanoi(n-1, auxiliary, destination, source)  # Driver code n = 4 Towe...

Draw Among Us Game Character using python turtle graphics

  Source Code :- import turtle BODY_COLOR = 'Red' BODY_SHADOW = '' GLASS_SHADOW = '' GLASS_COLOR = 'skyblue' s= turtle.getscreen() t= turtle.Turtle() # WE WILL DIVIDE CHARACTER INTO 3 PARTS : # BODY , GLASS, BACKPACK # FIRST CREATE BODY() def body():     t.pensize(20)     t.fillcolor(BODY_COLOR)     t.begin_fill()     #Right side     t.right(90)     t.forward(50)     t.right(180)     t.circle(40, -180)     t.right(180)     t.forward(200)          #head curve     t.right(180)     t.circle(100, -180)     #Left side     t.backward(20)     t.left(15)     t.circle(500,-20)     t.backward(20)          #t.backward(200)     t.circle(40,-180)     t.left(7)     t.backward(50)     #hip     t.up()     t.left(90)  ...

Wish Happy Friendship Day using Python turtle graphics

  Source Code:- import turtle screen=turtle.Screen() trtl=turtle.Turtle() screen.setup(620,620) screen.bgcolor('white') clr=['red','green','blue','yellow','purple'] trtl.pensize(4) trtl.shape('turtle') trtl.penup() trtl.pencolor('red') trtl.write(str(),align="center",font=("Arial", 12, "normal"))      trtl.home() trtl.setpos(0,-250) trtl.pendown() trtl.pensize(10) trtl.pencolor('blue') trtl.circle(400) trtl.penup() trtl.setpos(-370,100) trtl.pendown() trtl.pencolor('green') trtl.write('Happy friendship day',font=("Arial", 14,"normal")) trtl.color("red") trtl.begin_fill() trtl.penup() trtl.setpos(-70,200) trtl.pensize(5) trtl.left(50) trtl.forward(133) trtl.circle(50,200) trtl.right(140) trtl.circle(50,200) trtl.forward(133) trtl.end_fill() trtl.hideturtle() turtle.done()