Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

start :10 end: 16 increment:4Test case 2: ooo AT&T; 12:10 a mycourses.purdue.edu

ID: 3852399 • Letter: S

Question

start :10

end: 16

increment:4Test case 2:

ooo AT&T; 12:10 a mycourses.purdue.edu CS 177-Project #1 Summer 2017 Important Information: This is an individual assignment for you to complete on your own. If you need help, take advantage of the Piazza discussion board, office hours or the open forum lab. You may not work with or assist another student or receive assistance from anyone other than the CS 177 teaching staff Due Date: Submit your finished program to the Project 1 assignment on Blackboard by 11:59 pm on June 27h Problem Description: Spaced Multiplication & Division Tables Multiplication tables show the product of natural numbers in a tabular format. The rows represent the multiplicands and the columns represent the multipliers. Division tables are the same concept for division, and show the quotient. The rows represent the dividends and the columns represent the divisors. Generally, the dividends and multiplicands for these tables begin from 1 For Project 1, inputs N1 and N2 determine the range of dividends and multiplicands, and the Multiplication and Division tables are for natural numbers from N1 to N2 (both included). Include multipliers and divisors at increments of x, which will be provided as input. Inputs Starting number (N1), ending number (N2), and increment (x) Spaced Multiplication Table for N1 -N2, with multipliers 1, 1+X, 1+2X... 1+10x Spaced Division Table for N1 N2 with divisors 1,1+x, 1+2x Output: 1+10x Spaced Multiplication Table 5 51015 20 25 30 35 40 45 6 12 18 243036 7 7 14 21 28 35 42 8 16 2432 40 48 Spaced Division Table 1 3 5 711 13 1517 5 5.00 1.67 1.00 0.71 0.56 045 38 0.33 0.29 6 6.00 2.00 1.20 0.86 0.67 0.55 0.46 0.40 0.35 7 7.00 2.33 140 1.00 0.78 064 0.54 0.47 041 8 8.00 2.671.60 1.14 0.89 0.73 0.62 0.53 047 In all CS 177 assignments, you must follow the coding guidelines. Prior to writing any Python code, sing comments ( plan your program u for each section. Part 1: Determining the Values for the tables Write a Python program named project1.py that describes the program's function, then prompts the user for the values N1, N2 and x to be used in the tables. The program should then use the input values for the parts that follow

Explanation / Answer

# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""
import numpy as np

def printMatrix(a,n1,n2):
   rows = n1-n2+1
   for i in range(0,rows):
      for j in range(0,10):
         print ("%6.f" %a[i,j]),
      print()
   print()    


def printMatrixE(a,n1,n2):
   rows = n1-n2+1
   for i in range(0,rows):
      for j in range(0,10):
         print("%6.3f" %a[i,j]),
      print()
   print()

print("Spaced Multiplication Table for N1 - N2 with multipliers 1, 1+X, 1+2X, ....,1+10X ")
print("Spaced Division Table for N1 - N2 with divisors 1, 1+X, 1+2X, ....,1+10X ")

n1 = input("Enter N1: ")
n2 = input("Enter N2: ")
x = input("Enter X: ")
n1 = int(n1)
n2 = int(n2)
x = int(x)
matrixMul = []
for num in range(n1,n2+1):
    new = []
    for i in range(0,10):
        new.append(num*(1+i*x))
    matrixMul.append(new)
matrixDiv = []
for num in range(n1,n2+1):
    new1 = []
    for i in range(0,10):
        new1.append(num/(1+i*x))
    matrixDiv.append(new1)
  
print(" Spaced Multiplication Table for N1 - N2 ")
for i in range(len(matrixMul)):
    print()
    for j in matrixMul[i]:
        print("%d "%j,end='')      
print(" Spaced Division Table for N1 - N2 ")
for i in range(len(matrixDiv)):
    print()
    for j in matrixDiv[i]:
        print("%f "%j,end='')

----------------------------------------------OUTPUT---------------------------------------------------------------------

Spaced Multiplication Table for N1 - N2 with multipliers 1, 1+X, 1+2X, ....,1+10X

Spaced Division Table for N1 - N2 with divisors 1, 1+X, 1+2X, ....,1+10X


Enter N1: 10

Enter N2: 16

Enter X: 4

Spaced Multiplication Table for N1 - N2


10 50 90 130 170 210 250 290 330 370
11 55 99 143 187 231 275 319 363 407
12 60 108 156 204 252 300 348 396 444
13 65 117 169 221 273 325 377 429 481
14 70 126 182 238 294 350 406 462 518
15 75 135 195 255 315 375 435 495 555
16 80 144 208 272 336 400 464 528 592


Spaced Division Table for N1 - N2


10.000000 2.000000 1.111111 0.769231 0.588235 0.476190 0.400000 0.344828 0.303030 0.270270
11.000000 2.200000 1.222222 0.846154 0.647059 0.523810 0.440000 0.379310 0.333333 0.297297
12.000000 2.400000 1.333333 0.923077 0.705882 0.571429 0.480000 0.413793 0.363636 0.324324
13.000000 2.600000 1.444444 1.000000 0.764706 0.619048 0.520000 0.448276 0.393939 0.351351
14.000000 2.800000 1.555556 1.076923 0.823529 0.666667 0.560000 0.482759 0.424242 0.378378
15.000000 3.000000 1.666667 1.153846 0.882353 0.714286 0.600000 0.517241 0.454545 0.405405
16.000000 3.200000 1.777778 1.230769 0.941176 0.761905 0.640000 0.551724 0.484848 0.432432