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
Paha777 [63]
3 years ago
10

Write a short program using Python that will:

Computers and Technology
1 answer:
Alexxx [7]3 years ago
6 0

Answer:

// program in Python to check perfect number

#function to find number is perfect or not

def is_Perfect_Number(n):

   #total variable

   tot = 1

   i = 2

   #sum of all divisor of number

   while i*i<=n:

       if n%i==0:

           tot = tot + i + n/i

       if tot == n and n != 1:

           return 1

       i = i+1  

   return 0

#read until user enter a perfect number

while True:

   #read integer

   num = int(input("Input an integer: "))

   #call the function

   if(is_Perfect_Number(num)):

       print(num,"is perfect number")

       #if perfect number break

       break

   else:

       print(num,"is not a perfect number")

       #ask again

   print("try again.")

Explanation:

Read number from user and then call the function is_Perfect_Number() with  parameter "num".This will find the sum of all divisor of number.If sum is  equal to number then it will return 1 else return 0.If the number is not  perfect then it will again ask to enter a number until user enter a perfect  number.

Output:

Input an integer: 24

24 is not a perfect number                                                                                                

try again.                                                                                                                

Input an integer: 28                                                                                                      

28 is perfect number

You might be interested in
What would happen to a eukaryotic cell if all its mitochondriawere destroyed
julsineya [31]
The cell won't reproduce ATP.
4 0
3 years ago
What is the synonym for term port?
Rus_ich [418]
The synonym for term port is seaport

3 0
3 years ago
The file type blank identifies a word 2013 document
ZanzabumX [31]
Hey there! Hello!

The exclusive file type for Microsoft Word documents is .docx. You can see the attachment showing all the information you need to know about the example Word document I created. As long as you are using Word, the file type will be the same no matter what type of computer you're on or what it's running, so you don't need to worry about it being different for me on Mac than it might be for you on Windows. 

Hope this helped you out! Feel free to ask me any additional questions you may have. :-)

4 0
3 years ago
What is the law of the XNOR logic gate?
miskamm [114]

logic gate (AND, OR, XOR, NOT, NAND, NOR and XNOR) A logic gate is an elementary building block of a digital circuit. Most logic gates have two inputs and one output. At any given moment, every terminal is in one of the two binary conditions low (0) or high (1), represented by different voltage levels.Mar 6, 2018




Read more on Brainly.com - brainly.com/question/11896675#readmore

6 0
3 years ago
Suppose as a computer programmer, you have been assigned a task to develop a program to store the sorted data in ascending order
patriot [66]

Answer: i dont know but have an great day

Explanation:

5 0
2 years ago
Other questions:
  • What type of elements are bridges exposed to yearly
    13·2 answers
  • What is the term for the conversion of a bitmap image to a vector image?
    8·1 answer
  • "list at least 3 key performance indicators that should be considered prior to initiating a cloud deployment."
    15·1 answer
  • What kind of heat we feel from the sun
    15·2 answers
  • What do you call a set of programs?
    7·1 answer
  • Add me on Fortnite. Epic is smashman892. *Ik it sux but it's an old account* Comment ur epic
    6·2 answers
  • Most of the internal operations in a computer use hexagonal numbering true or false
    13·1 answer
  • Please help!!
    6·1 answer
  • Refers to the capacity to form bonds with particular
    11·2 answers
  • A ____ is someone who develops programs and apps or writes the instructions that direct the computer or mobile device to process
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!