computer science 225

profilep_patel359
Module5LabActivity.docx

Module 5: Lab Activity – Iterative Programming

Deliverables:

· Python program solutions to the following 5 problems

Make Sure You:

· Add comments

# Your name

# The date

# What the program does

· Test your program

· Fix any bugs (try out the debugging techniques you read about)

Problem 1 – Consider a program that prints “Hello World” to the screen 100 times. Use draw.io to draw the flow of execution. Then write the program. Submit both the flowchart and the code.

Problem 2 – Assume you have a list of numbers 12, 10, 32, 3, 66, 17, 42, 99, 20.

a. Write a loop that prints each of the numbers on a new line.

b. Write a loop that prints each number and its square on a new line.

Problem 3 – Write a program that asks the user for the number of sides, the length of the side, the color of the line, and the fill color of a regular polygon. The program should draw the polygon and then fill it in.

Problem 4 – Consider a program that iterates the integers from 1 to 50. For multiples of three print “Divisible by three” instead of the number and for the multiples of five print “Divisible by five”. For numbers which are multiples of both three and five print “Divisible by both”. Use draw.io to draw the flow of execution. Then write the program. Submit both the flowchart and the code.

Problem 5 – Write a program to draw some kind of picture. Be creative and experiment with the turtle methods provided in Summary of Turtle Methods.