0% found this document useful (0 votes)
33 views

Answers to Problems from Introduction to Programming Using Python by Y. Daniel Liang

The document is a solution manual for the book 'Introduction to Programming Using Python' by Y. Daniel Liang, containing Python code for various exercises. It includes a list of solved exercises, ranging from basic print statements to turtle graphics. The document provides code snippets for each exercise, demonstrating fundamental programming concepts.

Uploaded by

nazrinajeeb3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Answers to Problems from Introduction to Programming Using Python by Y. Daniel Liang

The document is a solution manual for the book 'Introduction to Programming Using Python' by Y. Daniel Liang, containing Python code for various exercises. It includes a list of solved exercises, ranging from basic print statements to turtle graphics. The document provides code snippets for each exercise, demonstrating fundamental programming concepts.

Uploaded by

nazrinajeeb3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

You can access complete document on following URL.

Contact me if site not loaded


https://solumanu.com/product/introduction-to-programming-using-python-liang/

This in a PDF converted from Python .py codes for Solution Manual of following book
Introduction to Programming Using Python - Y. Daniel Liang
sm
tb9
List of Solved Exercises
Exercise01_01 2
Exercise01_02 3
Exercise01_03 4
Exercise01_04 5
8
Exercise01_05 6
Exercise01_06 7
@
Exercise01_07 8
Exercise01_08 9
Exercise01_09 10
Exercise01_10 11
Exercise01_11 12
gm
Exercise01_12 13
Exercise01_13 14
Exercise01_14 15
Exercise01_15 16
Exercise01_16 17
Exercise01_17 18
ail
Exercise01_18 19
Exercise01_19 20
Exercise01_20 21
Exercise01_21 22
.co
m

WhatsApp: https://wa.me/message/2H3BV2L5TTSUF1 - Telegram: https://t.me/solutionmanual


Contact me in order to access the whole complete document - Email: [email protected]
Exercise01_01
print("Welcome to Python")
print("Welcome to Computer Science")
print("Programming is fun")
Exercise01_02
print("Welcome to Python")
print("Welcome to Python")
print("Welcome to Python")
print("Welcome to Python")
print("Welcome to Python")
Exercise01_01
Exercise01_03
print("FFFFFFF U U NN NN")
print("FF U U NNN NN")
print("FFFFFFF U U NN N NN")
print("FF U U NN N NN")
print("FF UUU NN NNN")
Exercise01_04

print("a a^2 a^3")


print("1 1 1")
print("2 4 8")
print("3 9 27")
print("4 16 64")
Exercise01_05

print((9.5 * 4.5 - 2.5 * 3) / (45.5 - 3.5))


Exercise01_06

print(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9)
Exercise01_07
print(4 * (1 - 1 / 3 + 1 / 5 - 1 / 7 + 1 / 9 - 1 / 11))
print(4 * (1 - 1 / 3 + 1 / 5 - 1 / 7 + 1 / 9 - 1 / 11 + 1 / 13 - 1 / 15))
Exercise01_08

print(5.5 * 5.5 * 3.14159)


print(2 * 5.5 * 3.14159)
Exercise01_09

print(4.5 * 7.9)
print(2 * (4.5 + 7.9))
Exercise01_10

print((14 / 45.5) * 60 / 1.6)


Exercise01_11

print(312032486 + 365 * 24 * 60 * 60 // 7 - 365 * 24 * 60 * 60 // 13 + 365 * 24 *


60 * 60 // 45)
print(312032486 + 2 * 365 * 24 * 60 * 60 // 7 - 2 * 365 * 24 * 60 * 60 // 13 + 2 *
365 * 24 * 60 * 60 // 45)
print(312032486 + 3 * 365 * 24 * 60 * 60 // 7 - 3 * 365 * 24 * 60 * 60 // 13 + 3 *
365 * 24 * 60 * 60 // 45)
print(312032486 + 4 * 365 * 24 * 60 * 60 // 7 - 4 * 365 * 24 * 60 * 60 // 13 + 4 *
365 * 24 * 60 * 60 // 45)
print(312032486 + 5 * 365 * 24 * 60 * 60 // 7 - 5 * 365 * 24 * 60 * 60 // 13 + 5 *
365 * 24 * 60 * 60 // 45)
Exercise01_12

import turtle

turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)

turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)

turtle.right(90)
turtle.forward(100)
turtle.right(180)

turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)

turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)

turtle.done()
Exercise01_13

import turtle

turtle.forward(50)
turtle.right(180)
turtle.forward(100)
turtle.right(180)
turtle.forward(50)

turtle.left(90)
turtle.forward(50)
turtle.left(180)
turtle.forward(100)

turtle.done()
Exercise01_14

import turtle

turtle.right(60)
turtle.forward(50)
turtle.right(120)
turtle.forward(50)
turtle.right(120)
turtle.forward(50)

turtle.done()
Exercise01_16

import turtle

turtle.right(60)
turtle.forward(50)
turtle.right(120)
turtle.forward(50)
turtle.right(120)
turtle.forward(100)

turtle.left(120)
turtle.forward(50)
turtle.left(120)
turtle.forward(50)

turtle.done()
Exercise01_17

import turtle

turtle.penup()
turtle.goto(-50, 0)
turtle.pendown()
turtle.circle(50)

turtle.penup()
turtle.goto(-50, -2 * 50)
turtle.pendown()
turtle.circle(50)

turtle.penup()
turtle.goto(50, 0)
turtle.pendown()
turtle.circle(50)

turtle.penup()
turtle.goto(50, -2 * 50)
turtle.pendown()
turtle.circle(50)

turtle.done()
Exercise01_18

import turtle

turtle.penup()
turtle.goto(-39, 48)
turtle.pendown()

turtle.write("(-39, 48)")
turtle.goto(50, -50)
turtle.write("(50, -50)")

turtle.done()
Exercise01_19

import turtle

turtle.penup()
turtle.goto(0, 100 / 2)
turtle.pendown()

turtle.right(72)
turtle.forward(100)

turtle.right(144)
turtle.forward(100)

turtle.right(144)
turtle.forward(100)

turtle.right(144)
turtle.forward(100)

turtle.right(144)
turtle.forward(100)

turtle.done()
Exercise01_20

import turtle

turtle.penup()
turtle.goto(80, 0)
turtle.pendown()

turtle.goto(40, -69.28)
turtle.goto(-40, -69.28)
turtle.goto(-80, -9.8)
turtle.goto(-40, 69)
turtle.goto(40, 69)
turtle.goto(80, 0)

turtle.hideturtle()

turtle.done()
Exercise01_21

import turtle

turtle.penup()
turtle.goto(-50, -50)
turtle.pendown()

turtle.goto(50, -50)
turtle.goto(50, 0)
turtle.goto(-50, 0)
turtle.goto(-50, -50)

turtle.goto(-25, -25)
turtle.goto(100 -25, -25)
turtle.goto(100 -25, 50 -25)

turtle.goto(-25, 50 -25)
turtle.goto(-25, -25)

turtle.penup()
turtle.goto(50, -50)
turtle.pendown()
turtle.goto(100 -25, -25)

turtle.penup()
turtle.goto(-50, 0)
turtle.pendown()
turtle.goto(-25, 25)

turtle.penup()
turtle.goto(100 -25, 25)
turtle.pendown()
turtle.goto(100-25 - 25, 25 - 25)

turtle.hideturtle()

turtle.done()
Exercise01_01

import turtle

turtle.color("green")
turtle.goto(-50, 0)

turtle.penup()
turtle.goto(0, 0)
turtle.pendown()
turtle.color("blue")
turtle.goto(60, 0)

turtle.penup()
turtle.goto(0, 0)
turtle.pendown()
turtle.color("red")
turtle.goto(0, 70)

turtle.color("black")
turtle.penup()
turtle.goto(0, -100)
turtle.pendown()
turtle.circle(100)

turtle.penup()
turtle.goto(-5, 85)
turtle.pendown()
turtle.write(12)

turtle.penup()
turtle.goto(90, 0)
turtle.pendown()
turtle.write(3)

turtle.penup()
turtle.goto(-95, 0)
turtle.pendown()
turtle.write(9)

turtle.penup()
turtle.goto(0, -100)
turtle.pendown()
turtle.write(6)

turtle.penup()
turtle.goto(-15, -115)
turtle.pendown()
turtle.write("9:15:00")

turtle.hideturtle()

turtle.done()

You might also like