Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

both of the problem is similar just need a extension Question 2 (10 Points) Factors of an Integer (Using If Statements) In a well-commented Python

image text in transcribedboth of the problem is similar just need a extension
Question 2 (10 Points) Factors of an Integer (Using If Statements) In a well-commented Python program hmwk2Q2.py, ask the user to provide an integer N using the built-in input function. Form a list of the respective factors as shown below and have your program print the list. The convention is NOT to include the integer itself in the enumerated factors list. Include a screen capture Hmwk2Q2.jpg for the test case below. Factors of a Number Program Enter an integer: 14043 [1, 3, 31, 93, 151, 453, 4681] Hmwk2Q2.jpg Hints: 1. Repetition is used to test the integers from 1 to N 1. (USE A FOR LOOP) 2. If the nth integer is a factor, then the list is appended. (USE AN IF-STATEMENT) 3. The modulo operator % is a useful operator to consider in the logical test. Grading: 2 points for comments, 2 points for correct repetition operator over the correct range, 2 points for the correct logical test, 2 points for the input function, and 2 points for Hmwk2Q2.jpg. Question 3 (10 Points) Prime Number In a well-commented Python program hmwk2Q3.py, extend the solution provided in Question 2 to determine if the integer N is a prime number. Include a screen capture Hmwk2Q3.jpg for the test case below. Is The Integer Prime ? Enter an integer: 7919 7919 is Prime Hmwk2Q3.jpg Grading: 2 points for comments, 2 points for a correct logical test to determine if number is prime from the list of the factors (no need to display the list), 4 points for extending code from Hmwk2Q2.py, and 2 points for Hmwk2Q3. jpg

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

Students also viewed these Databases questions