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

Please make it simple, this is an intro to programming class so it doesn\'t have

ID: 3866000 • Letter: P

Question

Please make it simple, this is an intro to programming class so it doesn't have to be a super complicated code. You can add whatever phrase you want, please don't leave spaces for me to fill in. Thank you

Write a program in Python that prompts the user for five positive whole numbers. Identify if each of these numbers is divisible by 2, 3, 5 or 7 Use formatted output to show a table on screen with the calculated information, including a row with the total Here is an example, considering that the user provided the following numbers: 15, 20, 21, 35 and 70 Number Divisible by 15 20 21 35 70 Total Remember: the user will only see what is on screen not what is inside the code. So, use clear and explanatory information. For the coding, use: camel notation in-program comments logic -accuracy

Explanation / Answer

import sys
divisors = [2, 3, 5, 7]
sums = [0, 0, 0, 0]
dividends= [15, 20, 21, 35, 70]
print '----------------------------------'
print 'number divisible by'
for i in range(len(divisors)):
    sys.stdout.write(' ' + `divisors[i]`)
print

print '----------------------------------'
for i in range(len(dividends)):
    sys.stdout.write(`dividends[i]`) //used so that new line is not printed
    for j in range(len(divisors)):
        sys.stdout.write(' ')
        if dividends[i] % divisors[j] == 0 :
            sys.stdout.write('x')
            sums[j] = sums[j] + 1
    print

print '----------------------------------'
sys.stdout.write('Total');
for i in range(len(sums)):
    sys.stdout.write(' ' + `sums[i]`)
print

The above code is very simple so havent commented. DO you want me to cimment the lines?