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

see example here . Write a program that prompts the user for a number N. Then it

ID: 3549507 • Letter: S

Question

see example here.

Write a program that prompts the user for a number N. Then it checks that the number N is in the range 1..100. If it is outside of the range, it just displays the error message Incorrect entry and terminates (see here). If it is in the range, the program computes and displays the first N good numbers, where a good number is a positive integer divisiable by 3 or by 5, see example here. Hints: To help you get started, here is a rough outline of the stages you should probably follow in writing your code: Prompt the user for N using eval(input(...)) Check the value of N If N is 1, just output 3 and terminate the program. Output 3. Initialize a counter to 1 indicating you already outputed 1 good numbets. Go through all numbers starting from 4 and check if the number is good. If so, output it and increment the counter by one -- it the counter's value exceeds N, terminate the program. If the number is not good, go to the next number. For each candidate integer, test whether it is good: to do this, you can use modular arithmetic, for example, the expression a % b returns the remainder after dividing the integer a by the integer b. oes any one good at Python, and can solve it? I tried so many codes, but they does not work.

Explanation / Answer

n= input("How many good numbers do you want ? ")
i=0
j=1
if(n>0 and n<101):
    while(i<n):
        if(j%3==0 or j%5==0):
            i=i+1
            print i," : ",j
        j=j+1
else:
    print "Incorrect entry"


for indentation copy code from here

https://www.dropbox.com/s/rtukgbazo30xwbr/kt.py


Test run 1

How many good numbers do you want ? 10
1 : 3
2 : 5
3 : 6
4 : 9
5 : 10
6 : 12
7 : 15
8 : 18
9 : 20
10 : 21


Test run 2

How many good numbers do you want ? 200
Incorrect entry