Skip to main content
SEE CS 2083 LEARN • PRACTICE • SUCCEED 🔍
Showing posts sorted by date for query SEE Computer Science Exam. Sort by relevance Show all posts
Showing posts sorted by date for query SEE Computer Science Exam. Sort by relevance Show all posts

Friday, July 10, 2026

Chapter 4 Programming in Python

🐍 Chapter 4: Programming in Python

SEE Computer Science 2083 - CDC New Curriculum. This chapter covers Python basics, user defined functions, libraries, graphics, file handling and data visualization.

🐍 Python 📘 Theory 💻 Practical 🚀 Project Work

4.1 Revision of Basics of Python

Introduction to Python

Python is a high-level, interpreted and general-purpose programming language. It is popular because of its simple syntax and easy readability.

Features of Python

  • Simple and easy to learn.
  • High level programming language.
  • Interpreted language.
  • Portable and platform independent.
  • Supports object oriented programming.
  • Provides large number of libraries.

Input and Output Statements

Input and Output statements are used to communicate with users. Input receives data and output displays results.

print() Statement

The print() function is used to display output on the screen.

print("Hello Python")
Output:
Hello Python

input() Function

The input() function is used to receive data from the user.

name = input("Enter your name: ")

print(name)
Output:
Enter your name: Ram

Ram

Data Types in Python

A data type defines the type of value stored in a variable.

Data Type Description Example
int Whole numbers 10
float Decimal numbers 10.5
str Text/String "Python"
bool True or False True

Variables in Python

A variable is a named memory location used to store data.

Example:
name = "Hari"

age = 16

marks = 90

Rules for Naming Variables

  • Must start with a letter or underscore.
  • Cannot start with a number.
  • No spaces are allowed.
  • Python keywords cannot be used.
  • Variable names are case sensitive.

Operators in Python

Operator Name
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus
** Power

Expressions

An expression is a combination of variables, values and operators that produces a result.

Examples:
10 + 5

a * b

x > y

Conditional Statements

Conditional statements are used to make decisions according to conditions.

if Statement

age = 18

if age >= 18:
    print("Eligible")

if-else Statement

age = 15

if age >= 18:
    print("Adult")

else:
    print("Child")

if-elif-else Statement

marks = 80

if marks >= 90:
    print("A")

elif marks >= 60:
    print("B")

else:
    print("C")

Loops in Python

Loops are used to repeat a block of code multiple times.

for Loop

for i in range(5):

    print(i)

while Loop

i = 1

while i <= 5:

    print(i)

    i = i + 1
⭐ SEE Exam Tips
  • input() always returns string data.
  • = is assignment operator.
  • == is comparison operator.
  • % gives remainder.
  • Indentation is compulsory in Python.

4.2 User Defined Functions

What is a Function?

A function is a block of organized and reusable code that performs a specific task. Functions help divide large programs into smaller and manageable parts.

Advantages of Functions

  • Code reusability.
  • Reduces repetition of code.
  • Makes programs easier to understand.
  • Improves program organization.
  • Makes debugging and maintenance easier.

Types of Python Functions

Function Type Description
Built-in Functions Functions already available in Python. Examples: print(), input(), len(), sum()
User Defined Functions Functions created by programmers according to their requirements.

Creating a User Defined Function

User defined functions are created using the def keyword.

Syntax

def function_name(parameters):

    statements

    return value

Example: Function without Parameter

def welcome():

    print("Welcome to Python")


welcome()
Output:
Welcome to Python

Function Call

A function call is the process of executing a function by writing its name followed by parentheses.

Example:
def greet():

    print("Hello")


greet()

Parameters and Arguments

Parameters

Parameters are variables written inside the function definition. They receive values when the function is called.

Example:
def add(a,b):

    print(a+b)
Here:
a and b are parameters

Arguments

Arguments are actual values passed to a function during function call.

Example:
add(10,20)
Here:
10 and 20 are arguments

Difference Between Parameter and Argument

Parameter Argument
Written in function definition Written during function call
Receives values Passes values
Example: a,b Example: 10,20

Scope of Variables

Scope defines the area where a variable can be accessed in a program.

1. Local Scope

A variable created inside a function is called a local variable. It can only be used inside that function.

Example:
def show():

    x = 10

    print(x)


show()

2. Global Scope

A variable created outside a function is called a global variable. It can be accessed throughout the program.

Example:
x = 20


def display():

    print(x)


display()

Return Statement

The return statement sends a value back from a function to the calling program.

Syntax:
return value
Example:
def square(n):

    return n*n


result = square(5)


print(result)
Output:
25

Types of Arguments

1. Positional Arguments

Arguments are passed in the same order as parameters.

Example:
def student(name,age):

    print(name,age)


student("Ram",16)

2. Default Arguments

A default argument has a predefined value.

Example:
def greet(name="Student"):

    print(name)


greet()

greet("Hari")
Output:
Student

Hari

3. Keyword Arguments

In keyword arguments, values are passed using parameter names.

Example:
def info(name,age):

    print(name,age)


info(age=16,name="Ram")

Functions Returning Values

A function that returns a result using return statement is called a non-void function.

Example:
def addition(a,b):

    return a+b


print(addition(5,3))
Output:
8

Void Functions

A function that performs a task but does not return any value is called a void function.

Example:
def message():

    print("Hello Python")


message()

Returning Multiple Values

Python allows a function to return multiple values separated by commas.

Example:
def calculate(a,b):

    return a+b, a-b


x,y = calculate(10,5)


print(x)

print(y)
Output:
15

5
⭐ SEE Exam Tips
  • Function is created using def keyword.
  • Parameters are written in function definition.
  • Arguments are passed during function call.
  • return sends result back to caller.
  • Local variables cannot be accessed outside function.

4.2 User Defined Functions

What is a Function?

A function is a block of organized and reusable code that performs a specific task. Functions help divide large programs into smaller and manageable parts.

Advantages of Functions

  • Code reusability.
  • Reduces repetition of code.
  • Makes programs easier to understand.
  • Improves program organization.
  • Makes debugging and maintenance easier.

Types of Python Functions

Function Type Description
Built-in Functions Functions already available in Python. Examples: print(), input(), len(), sum()
User Defined Functions Functions created by programmers according to their requirements.

Creating a User Defined Function

User defined functions are created using the def keyword.

Syntax

def function_name(parameters):

    statements

    return value

Example: Function without Parameter

def welcome():

    print("Welcome to Python")


welcome()
Output:
Welcome to Python

Function Call

A function call is the process of executing a function by writing its name followed by parentheses.

Example:
def greet():

    print("Hello")


greet()

Parameters and Arguments

Parameters

Parameters are variables written inside the function definition. They receive values when the function is called.

Example:
def add(a,b):

    print(a+b)
Here:
a and b are parameters

Arguments

Arguments are actual values passed to a function during function call.

Example:
add(10,20)
Here:
10 and 20 are arguments

Difference Between Parameter and Argument

Parameter Argument
Written in function definition Written during function call
Receives values Passes values
Example: a,b Example: 10,20

Scope of Variables

Scope defines the area where a variable can be accessed in a program.

1. Local Scope

A variable created inside a function is called a local variable. It can only be used inside that function.

Example:
def show():

    x = 10

    print(x)


show()

2. Global Scope

A variable created outside a function is called a global variable. It can be accessed throughout the program.

Example:
x = 20


def display():

    print(x)


display()

Return Statement

The return statement sends a value back from a function to the calling program.

Syntax:
return value
Example:
def square(n):

    return n*n


result = square(5)


print(result)
Output:
25

Types of Arguments

1. Positional Arguments

Arguments are passed in the same order as parameters.

Example:
def student(name,age):

    print(name,age)


student("Ram",16)

2. Default Arguments

A default argument has a predefined value.

Example:
def greet(name="Student"):

    print(name)


greet()

greet("Hari")
Output:
Student

Hari

3. Keyword Arguments

In keyword arguments, values are passed using parameter names.

Example:
def info(name,age):

    print(name,age)


info(age=16,name="Ram")

Functions Returning Values

A function that returns a result using return statement is called a non-void function.

Example:
def addition(a,b):

    return a+b


print(addition(5,3))
Output:
8

Void Functions

A function that performs a task but does not return any value is called a void function.

Example:
def message():

    print("Hello Python")


message()

Returning Multiple Values

Python allows a function to return multiple values separated by commas.

Example:
def calculate(a,b):

    return a+b, a-b


x,y = calculate(10,5)


print(x)

print(y)
Output:
15

5
⭐ SEE Exam Tips
  • Function is created using def keyword.
  • Parameters are written in function definition.
  • Arguments are passed during function call.
  • return sends result back to caller.
  • Local variables cannot be accessed outside function.

4.4 Graphics Using Turtle

Introduction to Turtle Module

The Turtle module is a built-in Python module used to create graphics by drawing lines, shapes and designs using a cursor called a turtle.

It is mainly used for learning programming in a simple and visual way.

Uses of Turtle Module

  • Helps learn programming through graphics.
  • Makes programming interactive and interesting.
  • Helps understand loops, functions and angles.
  • Improves creativity and logical thinking.
  • Makes errors easier to identify visually.

Basic Structure of Turtle Program

import turtle

pen = turtle.Turtle()

# Turtle commands

turtle.done()

Explanation of Commands

Command Description
import turtle Imports turtle module into the program.
turtle.Screen() Creates drawing window.
turtle.Turtle() Creates turtle object.
turtle.done() Keeps drawing window open.

Turtle Motion Commands

Command Purpose Example
forward() Moves turtle forward pen.forward(100)
backward() Moves turtle backward pen.backward(50)
right() Turns clockwise pen.right(90)
left() Turns anticlockwise pen.left(90)
circle() Draws circle pen.circle(50)

Color and Style Commands

Command Purpose
color() Changes pen color
fillcolor() Sets filling color
pensize() Changes pen thickness
speed() Controls drawing speed

Pen Control Commands

penup()

Lifts the pen and stops drawing.

Example:
pen.penup()

pen.forward(100)

pen.pendown()

pendown()

Places the pen down and starts drawing.

Position Commands

Command Purpose
goto(x,y) Moves turtle to specific position.
home() Returns turtle to starting position.
heading() Shows current direction.

Fill Commands

pen.begin_fill()

# drawing commands

pen.end_fill()

These commands fill closed shapes with colour.

Screen Commands

Command Purpose
clear() Removes drawings.
reset() Clears screen and resets turtle.
hideturtle() Hides turtle cursor.
showturtle() Shows turtle cursor.
bgcolor() Changes background colour.

Common Turtle Shapes

Shape Example
arrow pen.shape("arrow")
turtle pen.shape("turtle")
circle pen.shape("circle")
square pen.shape("square")
triangle pen.shape("triangle")

Solved Turtle Programs

1. Draw a Straight Line

import turtle

pen = turtle.Turtle()

pen.forward(200)

turtle.done()

2. Draw a Square

import turtle

pen = turtle.Turtle()


for i in range(4):

    pen.forward(100)

    pen.right(90)


turtle.done()

3. Draw a Rectangle

import turtle

pen=turtle.Turtle()


for i in range(2):

    pen.forward(150)

    pen.right(90)

    pen.forward(80)

    pen.right(90)


turtle.done()

4. Draw a Triangle

import turtle

pen=turtle.Turtle()


for i in range(3):

    pen.forward(120)

    pen.left(120)


turtle.done()

5. Draw a Circle

import turtle

pen=turtle.Turtle()

pen.circle(80)

turtle.done()
⭐ SEE Exam Tips
  • Turtle starts from center position (0,0).
  • Square turning angle = 90°.
  • Triangle turning angle = 120°.
  • Circle is drawn using circle() command.
  • begin_fill() and end_fill() are used for colouring shapes.

4.5 Error Handling

Introduction

Error handling is the process of detecting and handling errors during program execution so that the program does not crash suddenly.

Importance of Error Handling

  • Prevents program crashes.
  • Makes programs reliable.
  • Displays meaningful error messages.
  • Improves debugging.
  • Increases software quality.

Types of Errors in Python

Error Type Description
Syntax Error Error caused by violation of Python syntax rules. Example: Missing colon.
Runtime Error Error occurring during program execution. Example: Division by zero.
Logical Error Program runs but gives incorrect output.

Exception Handling

Exception handling is used to handle runtime errors using:

  • try
  • except
  • else
  • finally

try Block

The try block contains code that may produce an error.

except Block

The except block handles the error.

else Block

The else block executes when no error occurs.

finally Block

The finally block always executes whether error occurs or not.

Example of Exception Handling

try:

    a = int(input("Enter number:"))

    b = int(input("Enter number:"))

    result = a/b

    print(result)


except ZeroDivisionError:

    print("Cannot divide by zero")


finally:

    print("Program completed")

Common Python Exceptions

Exception Meaning
ZeroDivisionError Division by zero
ValueError Wrong value entered
TypeError Wrong data type
IndexError Invalid index
FileNotFoundError File does not exist

4.6 File Handling Using Pandas Library

Introduction

File handling is the process of storing data permanently in files and accessing that data when required.

File Handling Modes

Mode Purpose
r Read file
w Write file
a Append data

Pandas Library

Pandas is a Python library used for data handling and analysis. It uses DataFrame structure to store data.

Reading CSV File

import pandas as pd


data = pd.read_csv("student.csv")


print(data)

Writing CSV File

import pandas as pd


data = {

"Name":["Ram","Hari"],

"Age":[15,16]

}


df = pd.DataFrame(data)


df.to_csv("student.csv")

Advantages of Pandas

  • Easy data handling.
  • Reads CSV and Excel files.
  • Provides DataFrame structure.
  • Useful for data analysis.

4.7 Introduction to Data Visualization

Data visualization is the process of representing data in graphical form so that information can be understood easily.

Matplotlib Library

Matplotlib is a Python library used to create charts and graphs.

Types of Charts

1. Line Chart

A line chart shows changes in data over time.

Example:
import matplotlib.pyplot as plt


x=[1,2,3]

y=[4,5,6]


plt.plot(x,y)

plt.show()

2. Bar Graph

Bar graphs compare values between different categories.

Example:
import matplotlib.pyplot as plt


names=["A","B","C"]

marks=[80,90,70]


plt.bar(names,marks)

plt.show()

3. Pie Chart

Pie charts show percentage distribution of data.

Example:
import matplotlib.pyplot as plt


data=[40,30,20,10]


plt.pie(data)

plt.show()

Practical Tasks

  • Demonstrate structure of user defined functions.
  • Install and use Python packages and libraries such as Pandas, Turtle and Matplotlib.
  • Draw different shapes using Turtle graphics.
  • Read and write CSV files using Pandas.
  • Create bar, line and pie charts using Matplotlib.

Project Work

Develop a simple Python project using:

  • User defined functions.
  • Python libraries.
  • Data visualization tools.

Project Report Should Include

  • Introduction of project.
  • Problem definition.
  • Tools and libraries used.
  • Development process.
  • Program code.
  • Output screenshots.
  • Conclusion.

🎯 FREE SEE COMPUTER SCIENCE ONLINE QUIZ (2083)


🎓

MCQ Master Pro

SEE COMPUTER SCIENCE - CDC NEW CURRICULUM - 2083

Practice SEE Computer Science online for free with chapter-wise MCQs, timed exams, mastery tests, instant results, explanations and certificates.

📖

Practice Mode

Choose topic, subtopic, level and question count.

📝

Exam Mode

Attempt timed tests with 25, 50 or 75 questions.

🏆

Mastery Mode

Complete 100 questions and earn a certificate.

What You Get

✅ Chapter-wise MCQs
✅ Practice Mode
✅ Exam Mode
✅ Mastery Mode
✅ Instant Results
✅ Detailed Explanations
✅ Progress Tracking
✅ Certificates

Developed by Deepak Shrestha

Tuesday, June 30, 2026

SEE Quiz Master Pro v5.0 | Free Online Quiz for SEE Computer Science (CDC 2083)

SEE Quiz Master Pro v5.0 | Free Online Quiz for SEE Computer Science (CDC 2083)

Practice SEE Computer Science with 165 expert MCQs based on CDC New Curriculum 2083. Enjoy random questions, smart timer, negative marking, instant results, detailed answer review, and a mastery certificate for scores of 90% or above.
CLICK HERE TO MASTERY YOUR CHAPTER 1
Click the Link Below



🚀 SEE Quiz Master Pro v5.0 is Here! 🎉

I'm excited to introduce SEE Quiz Master Pro v5.0 – Computer Network & Communication, a professional online quiz platform specially designed for SEE Computer Science (CDC New Curriculum 2083).

Key Features
📘 165 Expert-Level MCQs
📱 100% Mobile-Friendly Design
🔀 Random Questions & Random Options
⏱️ Smart Timer Based on Question Count
🚫 No Back Option (Exam Mode)
💾 Auto Save & Resume Support
➖ Negative Marking (-0.25)
🏆 Mastery Certificate for 90% & Above
📊 Instant Results with Detailed Answer Review
📄 Download & Print Certificate
☁️ Google Sheets Integration for Automatic Record Keeping

This platform has been developed to provide students with a realistic, engaging, and exam-oriented practice experience while helping teachers manage quiz records efficiently.

A sincere thank you to everyone who shared suggestions and feedback during its development. More exciting features and improvements are already planned for future updates!

📚 Practice Smart. Learn Better. Master SEE Computer Science.

🌐 SEE Computer Science Blog: https://seeqbasicomputer.blogspot.com/

#SEEComputerScience #SEE2083 #ComputerScience #GoogleAppsScript #OnlineQuiz #EdTech #QuizMasterPro #MobileLearning #NepalEducation #DeepakShrestha





 

Saturday, June 6, 2026

100 Python Turtle Graphics Programs Question + Full Program Collection SEE COMPUTER SCIENCE CDC NEW CURRICULUM 2083

 



DOWNLOAD PDF

SEE COMPUTER SCIENCE

CDC NEW CURRICULUM 2083

100 Python Turtle Graphics Programs
Question + Full Program Collection

Level: Class 9/10 practical and exam preparation. Each item is written as an exam-style question followed by a complete program. Poor turtle, promoted from drawing one square to running an entire syllabus.

Index

1–20: Basic Shape Programs

21–35: Color & Fill Programs

36–50: Loop-Based Programs

51–70: Pattern Programs

71–85: Real Object Drawing Programs

86–100: Symbol & Special Design Programs


 

Basic Shape Programs

1. Straight Line

Question: Write a Python Turtle program to draw/create a straight line.

Program:

import turtle

t = turtle.Turtle()

t.forward(200)

turtle.done()

2. Square

Question: Write a Python Turtle program to draw/create a square.

Program:

import turtle

t = turtle.Turtle()

for i in range(4):
    t.forward(100)
    t.right(90)

turtle.done()

3. Rectangle

Question: Write a Python Turtle program to draw/create a rectangle.

Program:

import turtle

t = turtle.Turtle()

for i in range(2):
    t.forward(200)
    t.right(90)
    t.forward(100)
    t.right(90)

turtle.done()

4. Equilateral Triangle

Question: Write a Python Turtle program to draw/create a equilateral triangle.

Program:

import turtle

t = turtle.Turtle()

for i in range(3):
    t.forward(120)
    t.left(120)

turtle.done()

5. Pentagon

Question: Write a Python Turtle program to draw/create a pentagon.

Program:

import turtle

t = turtle.Turtle()

for i in range(5):
    t.forward(80)
    t.right(360/5)

turtle.done()

6. Hexagon

Question: Write a Python Turtle program to draw/create a hexagon.

Program:

import turtle

t = turtle.Turtle()

for i in range(6):
    t.forward(80)
    t.right(360/6)

turtle.done()

7. Heptagon

Question: Write a Python Turtle program to draw/create a heptagon.

Program:

import turtle

t = turtle.Turtle()

for i in range(7):
    t.forward(80)
    t.right(360/7)

turtle.done()

8. Octagon

Question: Write a Python Turtle program to draw/create a octagon.

Program:

import turtle

t = turtle.Turtle()

for i in range(8):
    t.forward(80)
    t.right(360/8)

turtle.done()

9. Nonagon

Question: Write a Python Turtle program to draw/create a nonagon.

Program:

import turtle

t = turtle.Turtle()

for i in range(9):
    t.forward(80)
    t.right(360/9)

turtle.done()

10. Decagon

Question: Write a Python Turtle program to draw/create a decagon.

Program:

import turtle

t = turtle.Turtle()

for i in range(10):
    t.forward(80)
    t.right(360/10)

turtle.done()

11. Circle

Question: Write a Python Turtle program to draw/create a circle.

Program:

import turtle

t = turtle.Turtle()

t.circle(100)

turtle.done()

12. Semi-circle

Question: Write a Python Turtle program to draw/create a semi-circle.

Program:

import turtle

t = turtle.Turtle()

t.circle(100, 180)

turtle.done()

13. Five-point Star

Question: Write a Python Turtle program to draw/create a five-point star.

Program:

import turtle

t = turtle.Turtle()

for i in range(5):
    t.forward(180)
    t.right(144)

turtle.done()

14. Diamond

Question: Write a Python Turtle program to draw/create a diamond.

Program:

import turtle

t = turtle.Turtle()

t.left(45)
for i in range(4):
    t.forward(100)
    t.right(90)

turtle.done()

15. Rhombus

Question: Write a Python Turtle program to draw/create a rhombus.

Program:

import turtle

t = turtle.Turtle()

for i in range(2):
    t.forward(150)
    t.right(60)
    t.forward(100)
    t.right(120)

turtle.done()

16. Kite Shape

Question: Write a Python Turtle program to draw/create a kite shape.

Program:

import turtle

t = turtle.Turtle()

t.left(60)
t.forward(120)
t.right(120)
t.forward(120)
t.right(60)
t.forward(80)
t.right(120)
t.forward(80)

turtle.done()

17. Arrow Shape

Question: Write a Python Turtle program to draw/create a arrow shape.

Program:

import turtle

t = turtle.Turtle()

t.forward(150)
t.left(150)
t.forward(60)
t.backward(60)
t.right(300)
t.forward(60)

turtle.done()

18. Cross Shape

Question: Write a Python Turtle program to draw/create a cross shape.

Program:

import turtle

t = turtle.Turtle()

for i in range(4):
    t.forward(60)
    t.backward(60)
    t.right(90)

turtle.done()

19. Plus Sign

Question: Write a Python Turtle program to draw/create a plus sign.

Program:

import turtle

t = turtle.Turtle()

t.pensize(6)
t.forward(100)
t.backward(200)
t.forward(100)
t.left(90)
t.forward(100)
t.backward(200)

turtle.done()

20. Spiral Line

Question: Write a Python Turtle program to draw/create a spiral line.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(80):
    t.forward(i * 3)
    t.right(45)

turtle.done()


 

Color & Fill Programs

21. Filled Square

Question: Write a Python Turtle program to draw/create a filled square.

Program:

import turtle

t = turtle.Turtle()

t.fillcolor('green')
t.begin_fill()
for i in range(4):
    t.forward(120)
    t.right(90)
t.end_fill()

turtle.done()

22. Filled Triangle

Question: Write a Python Turtle program to draw/create a filled triangle.

Program:

import turtle

t = turtle.Turtle()

t.fillcolor('blue')
t.begin_fill()
for i in range(3):
    t.forward(120)
    t.right(120)
t.end_fill()

turtle.done()

23. Filled Pentagon

Question: Write a Python Turtle program to draw/create a filled pentagon.

Program:

import turtle

t = turtle.Turtle()

t.fillcolor('orange')
t.begin_fill()
for i in range(5):
    t.forward(120)
    t.right(72)
t.end_fill()

turtle.done()

24. Filled Hexagon

Question: Write a Python Turtle program to draw/create a filled hexagon.

Program:

import turtle

t = turtle.Turtle()

t.fillcolor('purple')
t.begin_fill()
for i in range(6):
    t.forward(120)
    t.right(60)
t.end_fill()

turtle.done()

25. Filled Circle

Question: Write a Python Turtle program to draw/create a filled circle.

Program:

import turtle

t = turtle.Turtle()

t.fillcolor('red')
t.begin_fill()
t.circle(80)
t.end_fill()

turtle.done()

26. Filled Star

Question: Write a Python Turtle program to draw/create a filled star.

Program:

import turtle

t = turtle.Turtle()

t.color('yellow')
t.begin_fill()
for i in range(5):
    t.forward(180)
    t.right(144)
t.end_fill()

turtle.done()

27. Rainbow Circle

Question: Write a Python Turtle program to draw/create a rainbow circle.

Program:

import turtle

colors = ['red','orange','yellow','green','blue','purple']
t = turtle.Turtle()
t.speed(0)
for i in range(60):
    t.color(colors[i % 6])
    t.circle(100)
    t.right(6)

turtle.done()

28. Multicolor Square

Question: Write a Python Turtle program to draw/create a multicolor square.

Program:

import turtle

colors = ['red','blue','green','purple']
t = turtle.Turtle()
for i in range(4):
    t.color(colors[i])
    t.forward(120)
    t.right(90)

turtle.done()

29. Multicolor Triangle

Question: Write a Python Turtle program to draw/create a multicolor triangle.

Program:

import turtle

colors = ['red','green','blue']
t = turtle.Turtle()
for i in range(3):
    t.color(colors[i])
    t.forward(140)
    t.left(120)

turtle.done()

30. Multicolor Spiral

Question: Write a Python Turtle program to draw/create a multicolor spiral.

Program:

import turtle

colors = ['red','blue','green','orange','purple']
t = turtle.Turtle()
t.speed(0)
for i in range(100):
    t.color(colors[i % 5])
    t.forward(i * 4)
    t.right(91)

turtle.done()

31. Color Wheel

Question: Write a Python Turtle program to draw/create a color wheel.

Program:

import turtle

colors = ['red','orange','yellow','green','blue','purple']
t = turtle.Turtle()
t.speed(0)
for i in range(36):
    t.color(colors[i % 6])
    t.forward(160)
    t.backward(160)
    t.right(10)

turtle.done()

32. Random Color Pattern

Question: Write a Python Turtle program to draw/create a random color pattern.

Program:

import turtle
import random

colors = ['red','blue','green','orange','purple','black']
t = turtle.Turtle()
t.speed(0)
for i in range(100):
    t.color(random.choice(colors))
    t.forward(i * 3)
    t.right(59)

turtle.done()

33. Concentric Colored Circles

Question: Write a Python Turtle program to draw/create a concentric colored circles.

Program:

import turtle

colors = ['red','blue','green','purple','orange']
t = turtle.Turtle()
for i in range(5):
    t.color(colors[i])
    t.circle(30 + i * 20)

turtle.done()

34. Color-changing Flower

Question: Write a Python Turtle program to draw/create a color-changing flower.

Program:

import turtle

colors = ['red','blue','green','purple','orange','yellow']
t = turtle.Turtle()
t.speed(0)
for i in range(36):
    t.color(colors[i % 6])
    t.circle(100)
    t.right(10)

turtle.done()

35. Gradient Style Pattern

Question: Write a Python Turtle program to draw/create a gradient style pattern.

Program:

import turtle

colors = ['#2200ff','#5522dd','#8844bb','#aa6699','#cc8877']
t = turtle.Turtle()
t.speed(0)
for i in range(100):
    t.color(colors[i % 5])
    t.forward(i * 3)
    t.left(61)

turtle.done()


 

Loop-Based Programs

36. Square using Loop

Question: Write a Python Turtle program to draw/create a square using loop.

Program:

import turtle

t = turtle.Turtle()

for i in range(4):
    t.forward(100)
    t.right(90)

turtle.done()

37. Triangle using Loop

Question: Write a Python Turtle program to draw/create a triangle using loop.

Program:

import turtle

t = turtle.Turtle()

for i in range(3):
    t.forward(120)
    t.left(120)

turtle.done()

38. Pentagon using Loop

Question: Write a Python Turtle program to draw/create a pentagon using loop.

Program:

import turtle

t = turtle.Turtle()

for i in range(5):
    t.forward(80)
    t.right(360/5)

turtle.done()

39. Hexagon using Loop

Question: Write a Python Turtle program to draw/create a hexagon using loop.

Program:

import turtle

t = turtle.Turtle()

for i in range(6):
    t.forward(80)
    t.right(360/6)

turtle.done()

40. Star using Loop

Question: Write a Python Turtle program to draw/create a star using loop.

Program:

import turtle

t = turtle.Turtle()

for i in range(5):
    t.forward(180)
    t.right(144)

turtle.done()

41. Spiral Square

Question: Write a Python Turtle program to draw/create a spiral square.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(100):
    t.forward(i * 5)
    t.right(90)

turtle.done()

42. Spiral Triangle

Question: Write a Python Turtle program to draw/create a spiral triangle.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(90):
    t.forward(i * 4)
    t.left(120)

turtle.done()

43. Spiral Circle

Question: Write a Python Turtle program to draw/create a spiral circle.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(100):
    t.circle(i)
    t.right(10)

turtle.done()

44. Nested Loop Flower

Question: Write a Python Turtle program to draw/create a nested loop flower.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(18):
    for j in range(4):
        t.forward(100)
        t.right(90)
    t.right(20)

turtle.done()

45. Repeated Squares

Question: Write a Python Turtle program to draw/create a repeated squares.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(12):
    for j in range(4):
        t.forward(100)
        t.right(90)
    t.right(30)

turtle.done()

46. Repeated Triangles

Question: Write a Python Turtle program to draw/create a repeated triangles.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(12):
    for j in range(3):
        t.forward(120)
        t.left(120)
    t.right(30)

turtle.done()

47. Repeated Circles

Question: Write a Python Turtle program to draw/create a repeated circles.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(12):
    t.circle(80)
    t.right(30)

turtle.done()

48. Rotating Hexagons

Question: Write a Python Turtle program to draw/create a rotating hexagons.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(18):
    for j in range(6):
        t.forward(70)
        t.right(60)
    t.right(20)

turtle.done()

49. Rotating Stars

Question: Write a Python Turtle program to draw/create a rotating stars.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(10):
    for j in range(5):
        t.forward(120)
        t.right(144)
    t.right(36)

turtle.done()

50. Rotating Polygons

Question: Write a Python Turtle program to draw/create a rotating polygons.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(24):
    for j in range(5):
        t.forward(80)
        t.right(72)
    t.right(15)

turtle.done()


 

Pattern Programs

51. Flower Pattern

Question: Write a Python Turtle program to draw/create a flower pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(36):
    t.circle(100)
    t.right(10)

turtle.done()

52. Lotus Pattern

Question: Write a Python Turtle program to draw/create a lotus pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(18):
    t.circle(100)
    t.left(20)

turtle.done()

53. Sun Pattern

Question: Write a Python Turtle program to draw/create a sun pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(50):
    t.forward(180)
    t.backward(180)
    t.right(360/50)

turtle.done()

54. Spider Web

Question: Write a Python Turtle program to draw/create a spider web.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(36):
    t.forward(180)
    t.backward(180)
    t.right(10)

turtle.done()

55. Wheel Pattern

Question: Write a Python Turtle program to draw/create a wheel pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(24):
    t.forward(150)
    t.backward(150)
    t.right(15)

turtle.done()

56. Galaxy Pattern

Question: Write a Python Turtle program to draw/create a galaxy pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(180):
    t.circle(i)
    t.left(91)

turtle.done()

57. Shell Pattern

Question: Write a Python Turtle program to draw/create a shell pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(100):
    t.circle(i)
    t.right(10)

turtle.done()

58. Firework Pattern

Question: Write a Python Turtle program to draw/create a firework pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(72):
    t.forward(200)
    t.backward(200)
    t.right(5)

turtle.done()

59. Snowflake Pattern

Question: Write a Python Turtle program to draw/create a snowflake pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(8):
    for j in range(3):
        t.forward(100)
        t.backward(100)
        t.right(45)
    t.right(45)

turtle.done()

60. Wave Pattern

Question: Write a Python Turtle program to draw/create a wave pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(30):
    t.circle(40, 180)
    t.circle(-40, 180)

turtle.done()

61. Maze Pattern

Question: Write a Python Turtle program to draw/create a maze pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(50):
    t.forward(i * 8)
    if i % 2 == 0:
        t.left(90)
    else:
        t.right(90)

turtle.done()

62. Brick Wall Pattern

Question: Write a Python Turtle program to draw/create a brick wall pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for row in range(5):
    for col in range(4):
        for k in range(2):
            t.forward(80)
            t.right(90)
            t.forward(40)
            t.right(90)
        t.forward(90)
    t.penup()
    t.backward(360)
    t.right(90)
    t.forward(50)
    t.left(90)
    t.pendown()

turtle.done()

63. Eye Pattern

Question: Write a Python Turtle program to draw/create a eye pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(72):
    t.circle(100)
    t.left(5)

turtle.done()

64. Infinity Pattern

Question: Write a Python Turtle program to draw/create a infinity pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(36):
    t.circle(80)
    t.circle(-80)
    t.right(10)

turtle.done()

65. Zigzag Pattern

Question: Write a Python Turtle program to draw/create a zigzag pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(12):
    t.forward(50)
    t.left(60)
    t.forward(50)
    t.right(120)

turtle.done()

66. Staircase Pattern

Question: Write a Python Turtle program to draw/create a staircase pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(6):
    t.forward(50)
    t.left(90)
    t.forward(50)
    t.right(90)

turtle.done()

67. Chain Pattern

Question: Write a Python Turtle program to draw/create a chain pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(8):
    t.circle(40)
    t.penup()
    t.forward(80)
    t.pendown()

turtle.done()

68. Circular Flower

Question: Write a Python Turtle program to draw/create a circular flower.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(24):
    t.circle(60)
    t.right(15)

turtle.done()

69. Geometric Art Pattern

Question: Write a Python Turtle program to draw/create a geometric art pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(200):
    t.forward(i)
    t.left(59)

turtle.done()

70. Mathematical Curve Pattern

Question: Write a Python Turtle program to draw/create a mathematical curve pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(200):
    t.forward(i * 2)
    t.right(121)

turtle.done()


 

Real Object Drawing Programs

71. House

Question: Write a Python Turtle program to draw/create a house.

Program:

import turtle

t = turtle.Turtle()

for i in range(4):
    t.forward(150)
    t.left(90)
t.left(45)
t.forward(106)
t.right(90)
t.forward(106)

turtle.done()

72. Hut

Question: Write a Python Turtle program to draw/create a hut.

Program:

import turtle

t = turtle.Turtle()

for i in range(4):
    t.forward(140)
    t.left(90)
t.left(45)
t.forward(100)
t.right(90)
t.forward(100)
t.penup()
t.goto(45,0)
t.pendown()
for i in range(2):
    t.forward(40)
    t.left(90)
    t.forward(70)
    t.left(90)

turtle.done()

73. Tree

Question: Write a Python Turtle program to draw/create a tree.

Program:

import turtle

t = turtle.Turtle()

t.left(90)
t.forward(120)
t.right(90)
t.fillcolor('green')
t.begin_fill()
t.circle(50)
t.end_fill()

turtle.done()

74. Christmas Tree

Question: Write a Python Turtle program to draw/create a christmas tree.

Program:

import turtle

t = turtle.Turtle()

t.left(90)
t.forward(80)
t.right(150)
for i in range(3):
    t.forward(80)
    t.left(120)
    t.forward(80)
    t.left(120)
    t.forward(80)
    t.left(120)
    t.penup()
    t.left(30)
    t.backward(40)
    t.right(30)
    t.pendown()

turtle.done()

75. Car

Question: Write a Python Turtle program to draw/create a car.

Program:

import turtle

t = turtle.Turtle()

for i in range(2):
    t.forward(200)
    t.left(90)
    t.forward(70)
    t.left(90)
t.penup(); t.goto(50,-40); t.pendown(); t.circle(25)
t.penup(); t.goto(150,-40); t.pendown(); t.circle(25)

turtle.done()

76. Truck

Question: Write a Python Turtle program to draw/create a truck.

Program:

import turtle

t = turtle.Turtle()

for i in range(2):
    t.forward(220); t.left(90); t.forward(80); t.left(90)
t.penup(); t.goto(220,0); t.pendown()
for i in range(2):
    t.forward(80); t.left(90); t.forward(60); t.left(90)
t.penup(); t.goto(60,-35); t.pendown(); t.circle(20)
t.penup(); t.goto(210,-35); t.pendown(); t.circle(20)

turtle.done()

77. Boat

Question: Write a Python Turtle program to draw/create a boat.

Program:

import turtle

t = turtle.Turtle()

t.forward(200)
t.left(135)
t.forward(60)
t.left(45)
t.forward(115)
t.left(45)
t.forward(60)
t.penup(); t.goto(100,0); t.pendown(); t.left(135); t.forward(100); t.right(120); t.forward(80); t.right(120); t.forward(80)

turtle.done()

78. Rocket

Question: Write a Python Turtle program to draw/create a rocket.

Program:

import turtle

t = turtle.Turtle()

for i in range(2):
    t.forward(80); t.left(90); t.forward(160); t.left(90)
t.left(45); t.forward(57); t.right(90); t.forward(57)
t.penup(); t.goto(20,-40); t.pendown(); t.goto(40,0); t.goto(60,-40)

turtle.done()

79. Airplane

Question: Write a Python Turtle program to draw/create a airplane.

Program:

import turtle

t = turtle.Turtle()

t.forward(200)
t.backward(100)
t.left(140); t.forward(80); t.backward(80)
t.right(280); t.forward(80); t.backward(80)
t.left(140); t.backward(80)
t.left(140); t.forward(50); t.backward(50)
t.right(280); t.forward(50)

turtle.done()

80. Traffic Light

Question: Write a Python Turtle program to draw/create a traffic light.

Program:

import turtle

t = turtle.Turtle()

for i in range(2):
    t.forward(100); t.left(90); t.forward(250); t.left(90)
for y,c in [(180,'red'),(110,'yellow'),(40,'green')]:
    t.penup(); t.goto(50,y); t.pendown(); t.color(c); t.begin_fill(); t.circle(25); t.end_fill()

turtle.done()

81. Clock

Question: Write a Python Turtle program to draw/create a clock.

Program:

import turtle

t = turtle.Turtle()

t.circle(100)
for i in range(12):
    t.penup(); t.goto(0,100); t.right(30*i); t.forward(80); t.pendown(); t.forward(15); t.penup(); t.goto(0,0); t.setheading(0)
t.pendown(); t.left(90); t.forward(60); t.backward(60); t.right(45); t.forward(50)

turtle.done()

82. Mobile Phone

Question: Write a Python Turtle program to draw/create a mobile phone.

Program:

import turtle

t = turtle.Turtle()

for i in range(2):
    t.forward(100); t.left(90); t.forward(180); t.left(90)
t.penup(); t.goto(45,10); t.pendown(); t.circle(5)

turtle.done()

83. Laptop

Question: Write a Python Turtle program to draw/create a laptop.

Program:

import turtle

t = turtle.Turtle()

for i in range(2):
    t.forward(180); t.left(90); t.forward(110); t.left(90)
t.penup(); t.goto(-20,-40); t.pendown(); t.forward(220); t.right(120); t.forward(40); t.right(60); t.forward(180); t.right(60); t.forward(40)

turtle.done()

84. Cup Design

Question: Write a Python Turtle program to draw/create a cup design.

Program:

import turtle

t = turtle.Turtle()

t.forward(100); t.left(90); t.forward(120); t.left(90); t.forward(100); t.left(90); t.forward(120)
t.penup(); t.goto(100,70); t.pendown(); t.circle(30,180)

turtle.done()

85. Simple Robot

Question: Write a Python Turtle program to draw/create a simple robot.

Program:

import turtle

t = turtle.Turtle()

for i in range(4):
    t.forward(100); t.left(90)
t.penup(); t.goto(25,120); t.pendown(); t.circle(10)
t.penup(); t.goto(75,120); t.pendown(); t.circle(10)
t.penup(); t.goto(25,-80); t.pendown(); t.right(90); t.forward(80)
t.penup(); t.goto(75,0); t.pendown(); t.forward(80)

turtle.done()


 

Symbol & Special Design Programs

86. Nepal Flag Simple

Question: Write a Python Turtle program to draw/create a nepal flag simple.

Program:

import turtle

t = turtle.Turtle()

t.color('crimson')
t.forward(100)
t.left(135)
t.forward(70)
t.right(135)
t.forward(100)
t.left(135)
t.forward(70)

turtle.done()

87. Olympic Rings

Question: Write a Python Turtle program to draw/create a olympic rings.

Program:

import turtle

t = turtle.Turtle()



turtle.done()
colors = ['blue','black','red','yellow','green']
positions = [(-120,0),(0,0),(120,0),(-60,-50),(60,-50)]
for i in range(5):
    t.penup(); t.goto(positions[i]); t.pendown()
    t.color(colors[i])
    t.circle(50)

turtle.done()

88. Heart Shape

Question: Write a Python Turtle program to draw/create a heart shape.

Program:

import turtle

t = turtle.Turtle()

t.color('red')
t.begin_fill()
t.left(140)
t.forward(180)
t.circle(-90,200)
t.left(120)
t.circle(-90,200)
t.forward(180)
t.end_fill()

turtle.done()

89. Smiley Face

Question: Write a Python Turtle program to draw/create a smiley face.

Program:

import turtle

t = turtle.Turtle()

t.circle(100)
t.penup(); t.goto(-35,120); t.pendown(); t.circle(10)
t.penup(); t.goto(35,120); t.pendown(); t.circle(10)
t.penup(); t.goto(-40,70); t.setheading(-60); t.pendown(); t.circle(50,120)

turtle.done()

90. Emoji Face

Question: Write a Python Turtle program to draw/create a emoji face.

Program:

import turtle

t = turtle.Turtle()

t.fillcolor('yellow')
t.begin_fill(); t.circle(100); t.end_fill()
t.penup(); t.goto(-35,120); t.pendown(); t.circle(10)
t.penup(); t.goto(35,120); t.pendown(); t.circle(10)
t.penup(); t.goto(-40,70); t.setheading(-60); t.pendown(); t.circle(50,120)

turtle.done()

91. Yin Yang Simple

Question: Write a Python Turtle program to draw/create a yin yang simple.

Program:

import turtle

t = turtle.Turtle()

t.circle(100)
t.circle(50,180)
t.circle(-50,180)
t.penup(); t.goto(0,50); t.pendown(); t.circle(10)
t.penup(); t.goto(0,150); t.pendown(); t.circle(10)

turtle.done()

92. Chessboard Simple

Question: Write a Python Turtle program to draw/create a chessboard simple.

Program:

import turtle

t = turtle.Turtle()

for row in range(4):
    for col in range(4):
        for k in range(4):
            t.forward(40); t.right(90)
        t.forward(40)
    t.penup(); t.backward(160); t.right(90); t.forward(40); t.left(90); t.pendown()

turtle.done()

93. Target Board

Question: Write a Python Turtle program to draw/create a target board.

Program:

import turtle

t = turtle.Turtle()

colors = ['red','white','blue','white','red']
for i in range(5):
    t.penup(); t.goto(0,-20*(5-i)); t.pendown(); t.color(colors[i]); t.begin_fill(); t.circle(20*(5-i)); t.end_fill()

turtle.done()

94. UFO Design

Question: Write a Python Turtle program to draw/create a ufo design.

Program:

import turtle

t = turtle.Turtle()

t.circle(100)
t.penup(); t.goto(-70,40); t.pendown(); t.forward(140)
t.penup(); t.goto(-40,70); t.pendown(); t.circle(40)

turtle.done()

95. Fractal Tree

Question: Write a Python Turtle program to draw/create a fractal tree.

Program:

import turtle

t = turtle.Turtle()
t.left(90)
t.speed(0)

def tree(branch):
    if branch > 10:
        t.forward(branch)
        t.right(20)
        tree(branch - 15)
        t.left(40)
        tree(branch - 15)
        t.right(20)
        t.backward(branch)

tree(100)

turtle.done()

96. Hypnotic Spiral

Question: Write a Python Turtle program to draw/create a hypnotic spiral.

Program:

import turtle

colors = ['red','blue','green','yellow','purple']
t = turtle.Turtle()
t.speed(0)
for i in range(300):
    t.color(colors[i % 5])
    t.forward(i)
    t.right(98)

turtle.done()

97. Color Explosion

Question: Write a Python Turtle program to draw/create a color explosion.

Program:

import turtle

colors = ['red','orange','yellow','green','blue','purple']
t = turtle.Turtle()
t.speed(0)
for i in range(360):
    t.color(colors[i % 6])
    t.forward(i)
    t.left(59)

turtle.done()

98. DNA-like Pattern

Question: Write a Python Turtle program to draw/create a dna-like pattern.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(40):
    t.circle(30)
    t.penup(); t.forward(20); t.pendown()
    t.circle(-30)
    t.penup(); t.forward(20); t.pendown()

turtle.done()

99. Mandala Design

Question: Write a Python Turtle program to draw/create a mandala design.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(72):
    for j in range(6):
        t.forward(80)
        t.right(60)
    t.right(5)

turtle.done()

100. Creative Freehand Art

Question: Write a Python Turtle program to draw/create a creative freehand art.

Program:

import turtle

t = turtle.Turtle()

t.speed(0)
for i in range(150):
    t.forward(i * 2)
    t.right(89)
    t.circle(i % 40)

turtle.done()

Home 📖Chapters 🎯Quiz MCQs 🔍Search