Description
Objective:
To work with loops (for and while), break and continue in python.
Assignment:
- Input a number from the user and find the sum of all numbers starting from 1 to the given input using while loop.
- Input a number and check if it is prime or not using for loop.
- Input two numbers (first number should be smaller than second, otherwise show error message) and print all odd numbers between the given input numbers using while loop.
- Assign a string “CSCI161L” to a variable and print “CSCI” only using break statement.
- Print the numbers from 1 to 20 excluding 5, 10, 15 using continue statement.
Sample output:
Instructions:
Preferred programming environment:
OS
Interpreter Editor
: Linux (Mint)
: Python 3 (not Python 2)
: gedit or editor of your choice
The program is saved as a file with .py extension.
The program should include a comment block at the top with your name, course number and course section, assignment number