Need help in Python 3. I was told there's still a missing code but my output is already the same with my expected output. I was told to exclude n1 in my code. How do I exclude n1

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Need help in Python 3. I was told there's still a missing code but my output is already the same with my expected output. I was told to exclude n1 in my code. How do I exclude n1

Submitted Code
Ask for two user inputs n1 and n2. Keep asking for inputs until conditions below are satisfied.
n1 and n2 must be positive integers. n1 should be less than n2.
Language: Python 3
P Open in editor
Then print the following:
1 while(True):
Condition 1: all numbers bet. nl and n2 that are divisible by 7 and not divisible by 3
Condition 2: all numbers bet. n1 and n2 that are divisible by 5
nl=int (input("Enter nl: "));
n2=int(input("Enter n2: "));
if(nl>0 and n2>0 and n2>nl):
break;
print("Invalid input.");
2
3
4
Condition 3: all numbers bet. n1 and n2 that are divisible by 5 and divisible by 9
5
Sample Input #2
7 #initialize variables
8 countl,count2, count3=0,0,0;
9 for n in range (nl,n2):
if(n%7==0 and n%3!=0):
countl += 1
12 for n in range (nl,n2):
if(n%5==0):
Sample Input #1
1
1
10
46
11
1
1
13
Sample Output #1
2
14
count2 += 1
15 for n in range (nl,n2):
if(n%5==0 and n%9==0):
Enter nl: Enter n2: Number of integers that satisfy A from 3 to 46: 4
Number of integers that satisfy B from 3 to 46: 9
Number of integers that satisfy C from 3 to 46: 1
16
Sample Output #2
17
count3 += 1
18 print("Number of integers that satisfy A from "+str(n1)+" to "+str(n2)+": "+str(count1));
19 print("Number of integers that satisfy B from "+str(nl)+" to "+str(n2)+": "+str(count2));
20 print("Number of integers that satisfy C from "+str(n1)+" to "+str(n2)+": "+str(count3));
Enter nl: Enter n2: Invalid input.
Enter nl: Enter n2: Invalid input.
Enter nl: Enter n2: Number of integers that satisfy A from 1 to 2: 0
Number of integers that satisfy B from 1 to 2: 0
Number of integers that satisfy C from 1 to 2: 0
Transcribed Image Text:Submitted Code Ask for two user inputs n1 and n2. Keep asking for inputs until conditions below are satisfied. n1 and n2 must be positive integers. n1 should be less than n2. Language: Python 3 P Open in editor Then print the following: 1 while(True): Condition 1: all numbers bet. nl and n2 that are divisible by 7 and not divisible by 3 Condition 2: all numbers bet. n1 and n2 that are divisible by 5 nl=int (input("Enter nl: ")); n2=int(input("Enter n2: ")); if(nl>0 and n2>0 and n2>nl): break; print("Invalid input."); 2 3 4 Condition 3: all numbers bet. n1 and n2 that are divisible by 5 and divisible by 9 5 Sample Input #2 7 #initialize variables 8 countl,count2, count3=0,0,0; 9 for n in range (nl,n2): if(n%7==0 and n%3!=0): countl += 1 12 for n in range (nl,n2): if(n%5==0): Sample Input #1 1 1 10 46 11 1 1 13 Sample Output #1 2 14 count2 += 1 15 for n in range (nl,n2): if(n%5==0 and n%9==0): Enter nl: Enter n2: Number of integers that satisfy A from 3 to 46: 4 Number of integers that satisfy B from 3 to 46: 9 Number of integers that satisfy C from 3 to 46: 1 16 Sample Output #2 17 count3 += 1 18 print("Number of integers that satisfy A from "+str(n1)+" to "+str(n2)+": "+str(count1)); 19 print("Number of integers that satisfy B from "+str(nl)+" to "+str(n2)+": "+str(count2)); 20 print("Number of integers that satisfy C from "+str(n1)+" to "+str(n2)+": "+str(count3)); Enter nl: Enter n2: Invalid input. Enter nl: Enter n2: Invalid input. Enter nl: Enter n2: Number of integers that satisfy A from 1 to 2: 0 Number of integers that satisfy B from 1 to 2: 0 Number of integers that satisfy C from 1 to 2: 0
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education