Question
2. (10 points) Try doing a task 3 different ways: a. Use an interactive Python session (shell) to print out a line of 5 stars
2. (10 points) Try doing a task 3 different ways: a. Use an interactive Python session (shell) to print out a line of 5 stars 10 times (so there will be 10 lines of output, each line containing 5 stars) b. Write a function that does the same thing as above, having each line printed individually (you can do this either in the shell or in a module; either way, just copy and paste your code when submitting) c. Write a function that uses a loop to do the same thing List one advantage of each of the techniques used above.
3. (10 points) You have learned how to assign a value to a variable in Python: For example, total = 0 It is easy to modify the value stored in a variable: total = total + value now the value stored in total is 10, if the variable value has 10 Use the loop index variable to write a program that will find the sum of all the numbers from 1 to 100 Hint: make use of built-in function: range; notice that when you use the construction: for value in range(10), value will go through all the integers from 0 to 9, so adjust your program accordingly.
4.
Create and submit a Python program (in a module) that contains a main function that prints 17 lines of the following text:
Welcome to the third week of classes, CSC 110 Rules!
Your program must make use of definite loop (for) that runs for 17 times
PYTHON CODE PLEASE
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started