SlideShare a Scribd company logo
INTRODUCTION TO
MATH WITH PYTHON TURTLE
PHSTech Club
Portola High School
1001 Cadence
Irvine, CA 92618
NR Computer Learning Center
1835 W. Orangewood, Suite 200
Orange, CA 92868
(714) 505-3475
www.nrclc.com
OBJECTIVE
 Angle
 Circle
 Variable
PYTHON
An easy-to-learn programming language
Code is quite easy to read
Python has features that allow you to put together
simple animations for creating your own games.
https://trinket.io/python
PYTHONTURTLE FUNCTION FORWARD()
 Forward(distance) - Move the turtle forward by the specified distance, in the
direction the turtle is headed.
 Example
t.forward(100) # move 100 steps forward
ANGLE
ANGLE
Angles are a measure of turn and are measured in degrees.
Right Angle – Equal to 90o
StraightAngle – equal to 180o
Straight line – equal to 360o
PYTHONTURTLE FUNCTION LEFT() &
RIGHT()
 Left(angle) -Turn turtle left by angle units.
 Right(angle) -Turn turtle right by angle units.
 Example
t.forward(100) # move 100 steps forward
t.left(90) # turn 90 degrees to the left
t.forward(100) # move 100 steps forward
t.right(90) # turn 90 degrees to the right
t.forward(100) # move 100 steps forward
EXERCISE 1: USING 900 ANGLE
import turtle
t = turtle.Turtle()
t.forward(100)
t.left(90)
t.forward(100)
t.left(90)
t.forward(100)
t.left(90)
t.forward(100)
t.left(90)
EXERCISE 2: USING 650 ANGLE
import turtle
t = turtle.Turtle()
t.forward(50)
t.left(60)
t.forward(50)
t.left(60)
t.forward(50)
t.left(60)
t.forward(50)
t.left(60)
t.forward(50)
t.left(60)
t.forward(50)
t.left(60)
EXERCISE3: USING 450 ANGLE
import turtle
t = turtle.Turtle()
t.forward(50)
t.left(45)
t.forward(50)
t.left(45)
t.forward(50)
t.left(45)
t.forward(50)
t.left(45)
t.forward(50)
t.left(45)
t.forward(50)
t.left(45)
t.forward(50)
t.left(45)
t.forward(50)
t.left(45)
CIRCLE
PYTHON FUNCTION: CIRCLE()
turtle.circle(radius, extent, steps)
 radius - Draw a circle with given radius.The center is radius units left of the turtle;
 extent (optional)– an angle – determines which part of the circle is drawn. If
extent is not given, draw the entire circle. If extent is not a full circle, one endpoint
of the arc is the current pen position. Draw the arc in counterclockwise direction if
radius is positive, otherwise in clockwise direction. Finally the direction of the
turtle is changed by the amount of extent.
 Steps (optional)- determines the number of steps to use.
 Example
 turtle.circle(50) # draw full circle
 turtle.circle(120, 180) # draw a semicircle
EXERCISE 4: USINGVARIABLE
import turtle
t = turtle.Turtle()
t.circle(5)
t.circle(10)
t.circle(15)
t.circle(20)
t.circle(40)
t.circle(60)
VARIABLE
VARIABLE
A variable is a quantity that may change within the
context of a mathematical problem or
experiment.
Typically, we use a single letter to represent
a variable.
For example:
2 x + 5 y = 10
EXERCISE 5: USINGVARIABLE
import turtle
t = turtle.Turtle()
r = 5 # radius = 5
t.circle(r)
t.circle(r*2)
t.circle(r*3)
r = 20 # radius = 20
t.circle(r)
t.circle(r*2)
t.circle(r*3)
SHAPE(), PENUP(), PENDOWN()
PYTHON FUNCTION SHAPE(), PENUP(),
PENDOWN()
Shape(shapename) – Shapename can be ‘arrow’,
‘classic’, ‘turtle’ or ‘circle’
Penup() and Pendown() commands are used to move
around the screen
Pencolor(color) – Sets the color of the pen.
Pensize(size) – Sets the thickness of the pen.
EXERCISE 6: PENUP() & PENDOWN()
import turtle
t = turtle.Turtle()
t.shape("turtle")
t.stamp()
t.penup()
t.forward(30)
t.pendown()
t.stamp()
t.penup()
t.forward(30)
t.pendown()
t.stamp()
PROJECT OLYMPICS
import turtle
t = turtle.Turtle("turtle")
t.pensize(10)
t.penup()
t.setposition(-120, 60)
t.pendown()
t.color("blue")
t.circle(50)
t.penup()
t.setposition(-60, 0)
t.pendown()
t.color("yellow")
t.circle(50)
t.penup()
t.setposition(0, 60)
t.pendown()
t.color("black")
t.circle(50)
t.penup()
t.setposition(60, 0)
t.pendown()
t.color("green")
t.circle(50)
t.penup()
t.setposition(120,60)
t.pendown()
t.color("red")
t.circle(50)
CONDITIONAL STATEMENT
CONDITIONAL STATEMENT
 Conditional statements are used to check conditions and change the behavior of
the program accordingly.
 Syntax:
if EXPRESSION:
STATEMENTS
 The colon (:) is significant and required. It separates the header of the compound
statement from the body.
 The line after the colon must be indented (use four spaces for indenting).
 All lines indented the same amount after the colon will be executed whenever the
EXPRESSION is true.
CONDITIONAL OPERATOR
Meaning Python Symbols
Less than <
Greater than >
Less than or equal to <=
Greater than or equal to >=
Equal to ==
Not equal to !=
EXERCISE 7: EXAMPLE – IF .. ELIF .. ELSE..
import turtle
t = turtle.Turtle()
t.shape("turtle")
points = input(“Enter Points between 0 and 100: ")
Points = int (points)
if Points >= 90 and Points < 100:
t.left(90)
elif Points >= 80 and Points < 90:
t.right(90)
else:
t.left(0)
t.forward(100)
NR Computer Learning Center
1835W. Orangewood, Suite 200
Orange, CA 92868
(714) 505-3475
www.nrclc.com

More Related Content

Similar to Introduction to the basic mathematical concept with Python Turtle.

An Introduction To Python - Graphics
An Introduction To Python - GraphicsAn Introduction To Python - Graphics
An Introduction To Python - Graphics
Blue Elephant Consulting
 
Lesson 7: Vector-valued functions
Lesson 7: Vector-valued functionsLesson 7: Vector-valued functions
Lesson 7: Vector-valued functions
Matthew Leingang
 
String Manipulation in Python
String Manipulation in PythonString Manipulation in Python
String Manipulation in Python
Pooja B S
 
PRESENTATION ON TUPLES.pptx
PRESENTATION ON TUPLES.pptxPRESENTATION ON TUPLES.pptx
PRESENTATION ON TUPLES.pptx
rohan899711
 
Lesson 7: The Derivative
Lesson 7: The DerivativeLesson 7: The Derivative
Lesson 7: The Derivative
Matthew Leingang
 
Ry pyconjp2015 turtle
Ry pyconjp2015 turtleRy pyconjp2015 turtle
Ry pyconjp2015 turtle
Renyuan Lyu
 
014 TUPLES.pdf
014 TUPLES.pdf014 TUPLES.pdf
014 TUPLES.pdf
amman23
 
NAS-Ch4-Application of Laplace Transform
NAS-Ch4-Application of Laplace TransformNAS-Ch4-Application of Laplace Transform
NAS-Ch4-Application of Laplace Transform
Hussain K
 
STRING LIST TUPLE DICTIONARY FILE.pdf
STRING LIST TUPLE DICTIONARY FILE.pdfSTRING LIST TUPLE DICTIONARY FILE.pdf
STRING LIST TUPLE DICTIONARY FILE.pdf
omprakashmeena48
 
Admission in india
Admission  in indiaAdmission  in india
Admission in india
Edhole.com
 
Kotlin standard
Kotlin standardKotlin standard
Kotlin standard
Myeongin Woo
 
Mathematics TAKS Exit Level Review
Mathematics TAKS Exit Level ReviewMathematics TAKS Exit Level Review
Mathematics TAKS Exit Level Review
guest3f17823
 
Admmission in India
Admmission in IndiaAdmmission in India
Admmission in India
Edhole.com
 
Laplace transformation
Laplace transformationLaplace transformation
Laplace transformation
Santhanam Krishnan
 
Laplace & Inverse Transform convoltuion them.pptx
Laplace & Inverse Transform convoltuion them.pptxLaplace & Inverse Transform convoltuion them.pptx
Laplace & Inverse Transform convoltuion them.pptx
jyotidighole2
 
Vcla.ppt COMPOSITION OF LINEAR TRANSFORMATION KERNEL AND RANGE OF LINEAR TR...
Vcla.ppt COMPOSITION OF LINEAR TRANSFORMATION   KERNEL AND RANGE OF LINEAR TR...Vcla.ppt COMPOSITION OF LINEAR TRANSFORMATION   KERNEL AND RANGE OF LINEAR TR...
Vcla.ppt COMPOSITION OF LINEAR TRANSFORMATION KERNEL AND RANGE OF LINEAR TR...
Sukhvinder Singh
 
Ray Tracing with ZIO
Ray Tracing with ZIORay Tracing with ZIO
Ray Tracing with ZIO
Pierangelo Cecchetto
 
Solution Manual for Introduction to Programming Using Python 1st Edition by S...
Solution Manual for Introduction to Programming Using Python 1st Edition by S...Solution Manual for Introduction to Programming Using Python 1st Edition by S...
Solution Manual for Introduction to Programming Using Python 1st Edition by S...
romanelins
 
Functional programming in Swift
Functional programming in SwiftFunctional programming in Swift
Functional programming in Swift
John Pham
 
updated_tuple_in_python.pdf
updated_tuple_in_python.pdfupdated_tuple_in_python.pdf
updated_tuple_in_python.pdf
Koteswari Kasireddy
 

Similar to Introduction to the basic mathematical concept with Python Turtle. (20)

An Introduction To Python - Graphics
An Introduction To Python - GraphicsAn Introduction To Python - Graphics
An Introduction To Python - Graphics
 
Lesson 7: Vector-valued functions
Lesson 7: Vector-valued functionsLesson 7: Vector-valued functions
Lesson 7: Vector-valued functions
 
String Manipulation in Python
String Manipulation in PythonString Manipulation in Python
String Manipulation in Python
 
PRESENTATION ON TUPLES.pptx
PRESENTATION ON TUPLES.pptxPRESENTATION ON TUPLES.pptx
PRESENTATION ON TUPLES.pptx
 
Lesson 7: The Derivative
Lesson 7: The DerivativeLesson 7: The Derivative
Lesson 7: The Derivative
 
Ry pyconjp2015 turtle
Ry pyconjp2015 turtleRy pyconjp2015 turtle
Ry pyconjp2015 turtle
 
014 TUPLES.pdf
014 TUPLES.pdf014 TUPLES.pdf
014 TUPLES.pdf
 
NAS-Ch4-Application of Laplace Transform
NAS-Ch4-Application of Laplace TransformNAS-Ch4-Application of Laplace Transform
NAS-Ch4-Application of Laplace Transform
 
STRING LIST TUPLE DICTIONARY FILE.pdf
STRING LIST TUPLE DICTIONARY FILE.pdfSTRING LIST TUPLE DICTIONARY FILE.pdf
STRING LIST TUPLE DICTIONARY FILE.pdf
 
Admission in india
Admission  in indiaAdmission  in india
Admission in india
 
Kotlin standard
Kotlin standardKotlin standard
Kotlin standard
 
Mathematics TAKS Exit Level Review
Mathematics TAKS Exit Level ReviewMathematics TAKS Exit Level Review
Mathematics TAKS Exit Level Review
 
Admmission in India
Admmission in IndiaAdmmission in India
Admmission in India
 
Laplace transformation
Laplace transformationLaplace transformation
Laplace transformation
 
Laplace & Inverse Transform convoltuion them.pptx
Laplace & Inverse Transform convoltuion them.pptxLaplace & Inverse Transform convoltuion them.pptx
Laplace & Inverse Transform convoltuion them.pptx
 
Vcla.ppt COMPOSITION OF LINEAR TRANSFORMATION KERNEL AND RANGE OF LINEAR TR...
Vcla.ppt COMPOSITION OF LINEAR TRANSFORMATION   KERNEL AND RANGE OF LINEAR TR...Vcla.ppt COMPOSITION OF LINEAR TRANSFORMATION   KERNEL AND RANGE OF LINEAR TR...
Vcla.ppt COMPOSITION OF LINEAR TRANSFORMATION KERNEL AND RANGE OF LINEAR TR...
 
Ray Tracing with ZIO
Ray Tracing with ZIORay Tracing with ZIO
Ray Tracing with ZIO
 
Solution Manual for Introduction to Programming Using Python 1st Edition by S...
Solution Manual for Introduction to Programming Using Python 1st Edition by S...Solution Manual for Introduction to Programming Using Python 1st Edition by S...
Solution Manual for Introduction to Programming Using Python 1st Edition by S...
 
Functional programming in Swift
Functional programming in SwiftFunctional programming in Swift
Functional programming in Swift
 
updated_tuple_in_python.pdf
updated_tuple_in_python.pdfupdated_tuple_in_python.pdf
updated_tuple_in_python.pdf
 

More from NR Computer Learning Center

Power BI Desktop Overview
Power BI Desktop Overview Power BI Desktop Overview
Power BI Desktop Overview
NR Computer Learning Center
 
Building Dashboard with Excel
Building Dashboard with ExcelBuilding Dashboard with Excel
Building Dashboard with Excel
NR Computer Learning Center
 
Introduction to Data Analytics
Introduction to Data AnalyticsIntroduction to Data Analytics
Introduction to Data Analytics
NR Computer Learning Center
 
Python - Data Structures
Python - Data StructuresPython - Data Structures
Python - Data Structures
NR Computer Learning Center
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
NR Computer Learning Center
 
Office 2019 tips & tricks
Office 2019 tips & tricksOffice 2019 tips & tricks
Office 2019 tips & tricks
NR Computer Learning Center
 
App Development with Apple Swift Certification at Certiport Centers
App Development with Apple Swift Certification at Certiport CentersApp Development with Apple Swift Certification at Certiport Centers
App Development with Apple Swift Certification at Certiport Centers
NR Computer Learning Center
 
Project management fundamentals
Project management fundamentalsProject management fundamentals
Project management fundamentals
NR Computer Learning Center
 
National College Testing Association (NCTA)
National College Testing Association (NCTA)National College Testing Association (NCTA)
National College Testing Association (NCTA)
NR Computer Learning Center
 
National College Testing Association (NCTA)
National College Testing Association (NCTA)National College Testing Association (NCTA)
National College Testing Association (NCTA)
NR Computer Learning Center
 
Building a Dashboard in an hour with Power Pivot and Power BI
Building a Dashboard in an hour with Power Pivot and Power BIBuilding a Dashboard in an hour with Power Pivot and Power BI
Building a Dashboard in an hour with Power Pivot and Power BI
NR Computer Learning Center
 
Stem presentation - Pathways to Technology Oriented Careers
Stem presentation - Pathways to Technology Oriented CareersStem presentation - Pathways to Technology Oriented Careers
Stem presentation - Pathways to Technology Oriented Careers
NR Computer Learning Center
 
MTA 98 364 - database fundamentals
MTA 98 364 - database fundamentalsMTA 98 364 - database fundamentals
MTA 98 364 - database fundamentals
NR Computer Learning Center
 
MTA 361 software development fundamentals
MTA 361   software development fundamentalsMTA 361   software development fundamentals
MTA 361 software development fundamentals
NR Computer Learning Center
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
NR Computer Learning Center
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
NR Computer Learning Center
 
Executive dashboard for small business
Executive dashboard for small businessExecutive dashboard for small business
Executive dashboard for small business
NR Computer Learning Center
 
Building a Dashboard in an Hour using Microsoft PowerPivot & Power BI
Building a Dashboard in an Hour using Microsoft PowerPivot & Power BIBuilding a Dashboard in an Hour using Microsoft PowerPivot & Power BI
Building a Dashboard in an Hour using Microsoft PowerPivot & Power BI
NR Computer Learning Center
 
Arduino for teens
Arduino for teensArduino for teens
Arduino for teens
NR Computer Learning Center
 
Microsoft Office Specialist (MOS) Excel 2013 certification pathway
Microsoft Office Specialist (MOS) Excel 2013 certification pathwayMicrosoft Office Specialist (MOS) Excel 2013 certification pathway
Microsoft Office Specialist (MOS) Excel 2013 certification pathway
NR Computer Learning Center
 

More from NR Computer Learning Center (20)

Power BI Desktop Overview
Power BI Desktop Overview Power BI Desktop Overview
Power BI Desktop Overview
 
Building Dashboard with Excel
Building Dashboard with ExcelBuilding Dashboard with Excel
Building Dashboard with Excel
 
Introduction to Data Analytics
Introduction to Data AnalyticsIntroduction to Data Analytics
Introduction to Data Analytics
 
Python - Data Structures
Python - Data StructuresPython - Data Structures
Python - Data Structures
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Office 2019 tips & tricks
Office 2019 tips & tricksOffice 2019 tips & tricks
Office 2019 tips & tricks
 
App Development with Apple Swift Certification at Certiport Centers
App Development with Apple Swift Certification at Certiport CentersApp Development with Apple Swift Certification at Certiport Centers
App Development with Apple Swift Certification at Certiport Centers
 
Project management fundamentals
Project management fundamentalsProject management fundamentals
Project management fundamentals
 
National College Testing Association (NCTA)
National College Testing Association (NCTA)National College Testing Association (NCTA)
National College Testing Association (NCTA)
 
National College Testing Association (NCTA)
National College Testing Association (NCTA)National College Testing Association (NCTA)
National College Testing Association (NCTA)
 
Building a Dashboard in an hour with Power Pivot and Power BI
Building a Dashboard in an hour with Power Pivot and Power BIBuilding a Dashboard in an hour with Power Pivot and Power BI
Building a Dashboard in an hour with Power Pivot and Power BI
 
Stem presentation - Pathways to Technology Oriented Careers
Stem presentation - Pathways to Technology Oriented CareersStem presentation - Pathways to Technology Oriented Careers
Stem presentation - Pathways to Technology Oriented Careers
 
MTA 98 364 - database fundamentals
MTA 98 364 - database fundamentalsMTA 98 364 - database fundamentals
MTA 98 364 - database fundamentals
 
MTA 361 software development fundamentals
MTA 361   software development fundamentalsMTA 361   software development fundamentals
MTA 361 software development fundamentals
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
Executive dashboard for small business
Executive dashboard for small businessExecutive dashboard for small business
Executive dashboard for small business
 
Building a Dashboard in an Hour using Microsoft PowerPivot & Power BI
Building a Dashboard in an Hour using Microsoft PowerPivot & Power BIBuilding a Dashboard in an Hour using Microsoft PowerPivot & Power BI
Building a Dashboard in an Hour using Microsoft PowerPivot & Power BI
 
Arduino for teens
Arduino for teensArduino for teens
Arduino for teens
 
Microsoft Office Specialist (MOS) Excel 2013 certification pathway
Microsoft Office Specialist (MOS) Excel 2013 certification pathwayMicrosoft Office Specialist (MOS) Excel 2013 certification pathway
Microsoft Office Specialist (MOS) Excel 2013 certification pathway
 

Recently uploaded

BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
dot55audits
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
Chevonnese Chevers Whyte, MBA, B.Sc.
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Leena Ghag-Sakpal
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 

Recently uploaded (20)

BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 

Introduction to the basic mathematical concept with Python Turtle.

  • 1. INTRODUCTION TO MATH WITH PYTHON TURTLE PHSTech Club Portola High School 1001 Cadence Irvine, CA 92618 NR Computer Learning Center 1835 W. Orangewood, Suite 200 Orange, CA 92868 (714) 505-3475 www.nrclc.com
  • 3. PYTHON An easy-to-learn programming language Code is quite easy to read Python has features that allow you to put together simple animations for creating your own games. https://trinket.io/python
  • 4. PYTHONTURTLE FUNCTION FORWARD()  Forward(distance) - Move the turtle forward by the specified distance, in the direction the turtle is headed.  Example t.forward(100) # move 100 steps forward
  • 6. ANGLE Angles are a measure of turn and are measured in degrees. Right Angle – Equal to 90o StraightAngle – equal to 180o Straight line – equal to 360o
  • 7. PYTHONTURTLE FUNCTION LEFT() & RIGHT()  Left(angle) -Turn turtle left by angle units.  Right(angle) -Turn turtle right by angle units.  Example t.forward(100) # move 100 steps forward t.left(90) # turn 90 degrees to the left t.forward(100) # move 100 steps forward t.right(90) # turn 90 degrees to the right t.forward(100) # move 100 steps forward
  • 8. EXERCISE 1: USING 900 ANGLE import turtle t = turtle.Turtle() t.forward(100) t.left(90) t.forward(100) t.left(90) t.forward(100) t.left(90) t.forward(100) t.left(90)
  • 9. EXERCISE 2: USING 650 ANGLE import turtle t = turtle.Turtle() t.forward(50) t.left(60) t.forward(50) t.left(60) t.forward(50) t.left(60) t.forward(50) t.left(60) t.forward(50) t.left(60) t.forward(50) t.left(60)
  • 10. EXERCISE3: USING 450 ANGLE import turtle t = turtle.Turtle() t.forward(50) t.left(45) t.forward(50) t.left(45) t.forward(50) t.left(45) t.forward(50) t.left(45) t.forward(50) t.left(45) t.forward(50) t.left(45) t.forward(50) t.left(45) t.forward(50) t.left(45)
  • 12. PYTHON FUNCTION: CIRCLE() turtle.circle(radius, extent, steps)  radius - Draw a circle with given radius.The center is radius units left of the turtle;  extent (optional)– an angle – determines which part of the circle is drawn. If extent is not given, draw the entire circle. If extent is not a full circle, one endpoint of the arc is the current pen position. Draw the arc in counterclockwise direction if radius is positive, otherwise in clockwise direction. Finally the direction of the turtle is changed by the amount of extent.  Steps (optional)- determines the number of steps to use.  Example  turtle.circle(50) # draw full circle  turtle.circle(120, 180) # draw a semicircle
  • 13. EXERCISE 4: USINGVARIABLE import turtle t = turtle.Turtle() t.circle(5) t.circle(10) t.circle(15) t.circle(20) t.circle(40) t.circle(60)
  • 15. VARIABLE A variable is a quantity that may change within the context of a mathematical problem or experiment. Typically, we use a single letter to represent a variable. For example: 2 x + 5 y = 10
  • 16. EXERCISE 5: USINGVARIABLE import turtle t = turtle.Turtle() r = 5 # radius = 5 t.circle(r) t.circle(r*2) t.circle(r*3) r = 20 # radius = 20 t.circle(r) t.circle(r*2) t.circle(r*3)
  • 18. PYTHON FUNCTION SHAPE(), PENUP(), PENDOWN() Shape(shapename) – Shapename can be ‘arrow’, ‘classic’, ‘turtle’ or ‘circle’ Penup() and Pendown() commands are used to move around the screen Pencolor(color) – Sets the color of the pen. Pensize(size) – Sets the thickness of the pen.
  • 19. EXERCISE 6: PENUP() & PENDOWN() import turtle t = turtle.Turtle() t.shape("turtle") t.stamp() t.penup() t.forward(30) t.pendown() t.stamp() t.penup() t.forward(30) t.pendown() t.stamp()
  • 20. PROJECT OLYMPICS import turtle t = turtle.Turtle("turtle") t.pensize(10) t.penup() t.setposition(-120, 60) t.pendown() t.color("blue") t.circle(50) t.penup() t.setposition(-60, 0) t.pendown() t.color("yellow") t.circle(50)
  • 23. CONDITIONAL STATEMENT  Conditional statements are used to check conditions and change the behavior of the program accordingly.  Syntax: if EXPRESSION: STATEMENTS  The colon (:) is significant and required. It separates the header of the compound statement from the body.  The line after the colon must be indented (use four spaces for indenting).  All lines indented the same amount after the colon will be executed whenever the EXPRESSION is true.
  • 24. CONDITIONAL OPERATOR Meaning Python Symbols Less than < Greater than > Less than or equal to <= Greater than or equal to >= Equal to == Not equal to !=
  • 25. EXERCISE 7: EXAMPLE – IF .. ELIF .. ELSE.. import turtle t = turtle.Turtle() t.shape("turtle") points = input(“Enter Points between 0 and 100: ") Points = int (points) if Points >= 90 and Points < 100: t.left(90) elif Points >= 80 and Points < 90: t.right(90) else: t.left(0) t.forward(100)
  • 26. NR Computer Learning Center 1835W. Orangewood, Suite 200 Orange, CA 92868 (714) 505-3475 www.nrclc.com

Editor's Notes

  1. http://interactivepython.org/runestone/static/IntroPythonTurtles/Summary/summary.html https://docs.python.org/2/library/turtle.html
  2. https://www.mathopenref.com/angle.html
  3. http://interactivepython.org/runestone/static/IntroPythonTurtles/Summary/summary.html