In this assignment we are using Python concepts taught in weeks 1–5 of the semester. This includes
·expressions, statements, programs, data types, operators and strings,
·built-in functions and methods, such as mathematical functions or string methods,
·control flow, such as making decisions, looping over a range, or advanced looping.
The assignment will be submitted via GROK and assessment will be carried out using GROK test cases. The questions have been entered into GROK and initial test cases provided to get you started. You are encouraged to generate your own test cases and test your code thoroughly to avoid surprises.
For each question, you are asked to write a short Python program. The program for each question will be self-contained and will use the
input() function to gather information from the user (or the test case), and the
print() statement to report its results.
Each question gives samples sessions with the program you are to write, giving the input and the required output. Due to the GROK assessment process, your output is required to match the sample exactly, including spacing. You should have practiced this procedure in the week 2–5 labs.
You are not expected to check the input for errors, and nor are you expected to print error messages or throw exceptions. For Assignment 1, the test cases will not contain abnormal inputs. On the other hand, there is no penalty for applying ordinary defensive programming practices.