

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Background:
You are to create a function that uses a for-loop to output I love Python.
Assignment:
a. A for-loop that prints the string I love Python the number of times as the value of count. b. Number each line in the output as the output is printed. Allow 2 spaces to output the number. c. In addition, print the sum of the numbers from 1 to count.
1 I love Python 2 I love Python 3 I love Python 4 I love Python 5 I love Python 6 I love Python 7 I love Python The sum of the numbers from 1 to 7 is 28
love_python(3) print() love_python(18)
1 I love Python 2 I love Python 3 I love Python The sum of numbers from 1 to 3 is 6
1 I love Python 2 I love Python 3 I love Python 4 I love Python 5 I love Python 6 I love Python 7 I love Python 8 I love Python 9 I love Python 10 I love Python 11 I love Python 12 I love Python 13 I love Python 14 I love Python 15 I love Python 16 I love Python 17 I love Python 18 I love Python The sum of numbers from 1 to 18 is 171
print() love_python(5) print() love_python(22) print() love_python(45) print() love_python(87)
Before you turn this assignment in, make sure that your first_last_python_6 folder has 2 files:
Zip your first_last_python_6 folder and turn it in in the usual manner.