Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 5 - Loops - Programming Exercises - Page 168: 5.49

Answer

code

Work Step by Step

# 5.49 (Turtle: display a multiplication table) Write a program that displays a multiplication # table, as shown in Figure 5.4a. import turtle turtle.penup() turtle.goto(-140,180) turtle.pendown() turtle.write("Multiplication Table",font=("Arial", 20, "normal")) turtle.penup() turtle.goto(-140,130) turtle.pendown() for i in range(1,10): turtle.write(str(i),font=("Arial", 18, "normal")) turtle.penup() turtle.goto(turtle.xcor()+45,130) turtle.pendown() turtle.penup() turtle.goto(-170,110) turtle.pendown() turtle.write("-----------------------------------------",font=("Arial", 20, "normal")) turtle.penup() turtle.goto(-170,90) turtle.pendown() for i in range(1,10): turtle.write(str(i)+"|", font=("Arial", 18, "normal")) turtle.penup() turtle.goto(-170,turtle.ycor()-45) turtle.pendown() turtle.penup() turtle.goto(-140,90) turtle.pendown() for i in range(1,10): for j in range(1,10): turtle.write(str(i*j),font=("Arial", 18, "normal")) turtle.penup() turtle.goto(turtle.xcor()+45,turtle.ycor()) turtle.pendown() turtle.penup() turtle.goto(-140,turtle.ycor()-45) turtle.pendown() turtle.done()
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.