1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
NNADVOKAT [17]
3 years ago
12

Python Write a program that asks the user for an integer and then prints out all its factors.

Computers and Technology
1 answer:
scoray [572]3 years ago
7 0

Answer:

def display_factors(num):

   for counter in range(1, num+1):

       if num % counter == 0:

           print(counter)

int_num= int(input("Enter a number : "))

print("The factors for {} are : ".format(int_num))

display_factors(int_num)

Explanation:

The function display_factors is used to display all factors of a number entered by a user.

  • In this  for counter in range(1, num+1) the for loop is iterated until counter is greater  to num is false.   Counter variable starts from 1 and ends when it gets greater than the input number.
  • if num % counter == 0: In this statement, each loop  iteration, checks whether a number (num) is exactly divisible by counter. It is the condition for counter to be a factor of num.
  • print(counter) This is used to display factors of an input number
  • int_num= int(input("Enter a number : ")) This statement asks user to enter a number (int_num) which will be an integer.
  • display_factors(int_num) This calls display_factors number to find the factors of an input number.

You might be interested in
You want to add a new Product and Services entry to your client's QuickBooks Online company. The service is installation of a se
Kisachek [45]

Answer:  

The correct answer is Option 3: "Select Service"  

You have to select "Service" in the Second Step.  

Only after that, you'll be able to name the Service in the following step.  

Other options are invalid for a given question.

6 0
2 years ago
If you have different movie or audio file types saved to your computer and your computer can only play the OGG format instead of
galina1969 [7]

Answer:

convert the MP4 format file to the OGG format file                  

Explanation:        

An OGG file is a compressed audio file of Ogg Vorbis that is used for holding audio data. It is a free and an open container file format which is maintained by Xiph.Org Foundation. OGG format file can multiplex independent streams of video, text, audio and meta data.

The OGG file has better sound quality and characteristics than a MP3 or MP4 files. The MP4 file format can be converted into OGG format file if the files are saved in different formats in the computer which can play only OGG format.

5 0
2 years ago
A company has two finalists in mind to run its computer network: Bill, a college graduate in computer science with little experi
irga5000 [103]
Sam has more experience
5 0
3 years ago
If $350 is the profit of an initial investment of $1000.00, what is the percentage profit?​
umka2103 [35]

Answer:

35%

Explanation:

1000x=350

x=350/1000

x=0.35

35%

6 0
2 years ago
Read 2 more answers
Derived Classes Warrior Stores the warrior's allegiance as a string. The warrior does not attack warriors that have the same all
olga_2 [115]

Answer:

Find the detailed code in attached file.

Explanation:

See the attached file.

Download txt
8 0
2 years ago
Other questions:
  • Comparing tools made of stone, iron, and bronze: place them in the correct order from least to most durable
    14·1 answer
  • A ____ client locates all or most of the processing logic on the server.
    11·1 answer
  • A ____ is a collection of computers and users that are identified by a common security database. workgroup controller segment do
    7·1 answer
  • Which of the following is the correct order of the SDLC?
    14·1 answer
  • 1. When the Cisco 2950 switch is first turned on, it behaves like a hub. Why is this so, and what must happen before the switch
    5·1 answer
  • Swapping two input integers if they are not the same. (use switch-case
    10·1 answer
  • What is your impression on the subject fundamentals of database systems?​
    7·1 answer
  • Giusp minfg gấp vs ạ đáp án thôi nhé
    15·1 answer
  • Here’s my last question
    12·2 answers
  • which of the following statements about the evolving relationship between traditional newspaper operations and blogging is true?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!