Please Subscribe My YouTube Channel

Tuesday, March 14, 2023

How to Draw Square with Python.

How to Draw Square with Python :-

import turtle #first we import turtle lib
tur=turtle.Turtle() #create a storage to store turtle lib
tur.color("red")
tur.pensize(5)
tur.hideturtle() #turtle will be hide when square is drawing
'''now we create a square you can use fd or forward to move
the turtle to forward side and rt or right
for move turtle to right side.'''
tur.fd(200)
tur.rt(90)
tur.fd(200)
tur.rt(90)
tur.fd(200)
tur.rt(90)
tur.fd(200)
tur.rt(90)
turtle.done() #tell to compiler that program is done

#note: - Using for loop

import turtle #first we import turtle lib
tur=turtle.Turtle() #create a storage to store turtle lib
tur.color("red")
tur.pensize(5)
tur.hideturtle() #turtle will be hide when square is drawing
'''now we create a square you can use fd or forward to move
the turtle to forward side and rt or right
for move turtle to right side.'''
for i in range(4):
    tur.fd(200)
    tur.rt(90)
turtle.done() #tell to compiler that program is done


How To Make Vote Age Calculator with Python

How To Make Vote Age Calculator with Python


print("Hi!\nWelcome To Voting Pannel")
age=int(input("Enter your age:- "))
if age >=18:
    print("you Are Eligible For Vote")
else:
    print("you Are Not Eligible For Vote")



Watch full video about this blog.


Sunday, March 12, 2023

How to draw Batsman with Python Programming:-

How to draw Batsman with Python Programming:-


import turtle

#initialize method

bat = turtle.Turtle()

#size of pointer and pen
bat.turtlesize(1, 1, 1)
bat.pensize(3)

#screen info
wn = turtle.Screen()
wn.bgcolor("red")
wn.title("BATMAN")

#colour
bat.color("yellow", "black")


#begin filling color
bat.begin_fill()

#turn1
bat.left(90)   # turn pointer direction to left of 90'
bat.circle(50, 85) #draw circle of radius = 50 and 85'
bat.circle(15, 110)
bat.right(180)

#turn 2
bat.circle(30, 150)
bat.right(5)
bat.forward(10) #draw forward line of 10 units

#turn 3
bat.right(90)
bat.circle(-70, 140)
bat.forward(40)
bat.right(110)

#turn 4
bat.circle(100, 30)
bat.circle(30, 100)
bat.left(50)
bat.forward(50)
bat.right(145)

#turn5
bat.forward(30)
bat.left(55)
bat.forward(10)

#reverse

#turn 5
bat.forward(10)
bat.left(55)
bat.forward(30)

#turn 4

bat.right(145)
bat.forward(50)
bat.left(50)
bat.circle(30, 100)
bat.circle(100, 30)

#turn 3
bat.right(90)
bat.right(20)
bat.forward(40)
bat.circle(-70, 140)

#turn 2
bat.right(90)
bat.forward(10)
bat.right(5)
bat.circle(30, 150)

#turn 1
bat.left(180)
bat.circle(15, 110)
bat.circle(50, 85)

#end color filling
bat.end_fill()

#end the turtle method
turtle.done()