Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python Problem # 1 description and solution requirements a. Declare two variables operand1 and operand2 of type int. Use them to illustrate integei operators. Write
python
Problem \# 1 description and solution requirements a. Declare two variables operand1 and operand2 of type int. Use them to illustrate integei operators. Write the results to standard output (i.e., your computer screen). b. Write global code in the module numOps.py to solve the problem described above. i. Declare 6 more variables that would hold each of the arithmetic operation results. For example, total =a+b and diff =ab and so on. ii. Write a single print statement for each line of outputs shown below. 1234+5=123912345=122912345=61701234//5=2461234%5=412345=2861381721051424 1. Problem \#2 preparation, description, and solution requirements a. Add a new package named hw1p2 to the src folder of your homework project you have just created above. b. Add a module forLoopOps.py to the hw1p2 package c. Declare a variable n where n gets 0,1,2,3,4, or 5 . Write to standard output (i.e., your computer screen) an n-by-n table with an asterisk in row i and column j if either i divides jor j divides i. a. Write global code in the module forLoopOps.py to solve the problem described above to display the output shown below the problem \#3. Your solution must include for loop(s). Do not use any while loops. Hints: use the range function and nested for loops. 2. Make sure your solutions work as required before you move on to the next problem. c. As described in the problem \#2, declare a variable n where n gets 0,1,2,3,4, or 5 . Write to standard output (i.e., your computer screen) an n-by-n table with an asterisk in row i and column j if either i divides j or j divides i. d. Write global code in the module whileLoopOps.py to solve the problem described above to display the output shown below. Your solution must include while loop(s). Do not use any for loops Make sure your solutions work as required betore you move on to the next problem. For n=0 : For n=1 : * 1 For n=2 ** 1 ** 2 For n=3 1 2 3 For n=4 For n=5 Problem \#4 preparation, description, and solution requirements a. Add a new package named hw1p4 to the src folder of your homework project. b. Add a module funcOps.py to the hw1p4 package. c. Write three functions as follows: i. Define a function with two parameters to solve the problem \#1 for the given output. ii. Define a function with one parameter to solve the problem \#2 for the given output. iii. Define a function with one parameter to solve the problem \#3 for the given output. d. Call the three functions with appropriate arguments on the bottom of the same module (after the last function) to get the specified outputs as follows. \[ \begin{array}{l} \text { if _name }==" \text { main _": } \\ \text { \# call function 1 } \\ \text { \# call function 2, and so on } \end{array} \] 2. Make sure your solutions work as required before you submit your 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