Question: Part 1: Read 2 numbers from the user. One small number and one big number for the range. Use this in a for loop with
-
Part 1:
-
Read 2 numbers from the user. One small number and one big number for the range.
-
Use this in a for loop with range (for x in range(small, big))
-
Add all the numbers in this range and store in a variable called total.
-
Print total.
-
-
Part 2:
-
Make a list of colors called COLORS. Have at least 10 colors.
-
Read one color from the user in a variable called color.
-
Now use a for loop, and see if the color the user enters is there in your list.
-
If it is there, output that their color is found, else, output color not found.
-
-
Part 3:
-
Now go through the list of colors and print all the colors that have 3 letters or less.
-
Go through the list of colors and print all the colors that have 5 letters or more.
-
References:
Refer to this pdf file (link here) or refer here for more tutorials.
-
Section 1.13.2 The list Type
-
Section 1.13.3 The range Function, Part 1 from the pdf file
-
Section 1.13 Loops and Sequences from the pdf file.
My powerpoints in this module.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
