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 are some tasks for which you can use the VBA Editor? i need help for my computer class.
Murljashka [212]

Answer:

Visual Basic for Applications runs as an internal programming language in Microsoft Office applications such as Access, Excel, PowerPoint, Publisher, Word, and Visio. VBA allows users to customize beyond what is normally available with MS Office host applications by manipulating graphical-user-interface (GUI) features such as toolbars and menus, dialogue boxes, and forms. You may use VBA to create user-defined functions (UDFs), access Windows application programming interfaces (APIs), and automate specific computer processes and calculations. Macros can automate just about any task—like generating customized charts and reports, and performing word- and data-processing functions. Programmers,like replicating large pieces of code, merging existing program functions, and designing specific languages. VBA can also work in non-Microsoft settings by using a technology called "COM interface," which allows commands to interact across computer boundaries. Many firms have implemented VBA within their own applications, both proprietary and commercial, including AutoCAD, ArcGIS, CATIA, Corel, raw, and SolidWorks.

<em>(Hope this helps/makes sense!)</em>

6 0
3 years ago
Which of the following is not a technology that can be used to conserve resources?
amm1812
<span>Natural gas when extracted through human industry will utilise resources to construct the necessary plant and machinery and then result in the consumption of a resource. Therefore this is the technology that cannot be seen as conserving resources.</span>
6 0
3 years ago
Read 2 more answers
For this step, submit your work in the programming environment by running your code, checking your code for a score. The score y
34kurt

A sample HTML code that contains headers, paragraph tags, hyperlinks is

  • <h1> This is a header </h1>
  • <h2> This is a subtitle heading </h2>
  • <p> This is a paragraph </p>
  • <a href=”www.brainly.com”> Brainly Website </a>

<h3>What is HTML?</h3>

This is the building block of a website and is an acronym that means Hypertext Markup Language.

The HTML code that can be used to add a sample image is: "<img src="pic_Brainly.jpeg" alt="Brainly" width="500" height="333">

The src code means the specific location of the external resource

The width and height show how tall and wide the image would be.

The alt shows the alternative information for the image that can be seen when a person hovers over the image on the website.

Read more about HTML and CSS here:

brainly.com/question/24051672

#SPJ1

3 0
2 years ago
Can I make all front end project with Javascript OOP(Object Oriented Programming)?
anyanavicka [17]

Answer:

yeah u can my brother go for it

6 0
2 years ago
How to do 2. Pleaser
V125BC [204]

Answer:

GOD HAS FORSAKEN YOU NOW PRAISE DHAR MANN

6 0
3 years ago
Other questions:
  • When you declare an array, _____________________ You always reserve memory for it in the same statement You might reserve memory
    9·1 answer
  • A Network Attached Storage device is good for _____.
    11·2 answers
  • What is an example of a hard skill?
    12·2 answers
  • A prefab allows you to reuse game objects over and over, while their component data remains intact. (1 point)
    14·1 answer
  • Pride Group of Companies is making tremendous profits in different categories of electronic goods. The group of managers have to
    12·1 answer
  • What is the range for copper tape
    15·1 answer
  • Please hurry
    15·2 answers
  • Brainliest
    13·2 answers
  • Help me please. I dont really understand this.
    12·2 answers
  • In cyber security, one of the best ways to protect a computer or network is with a strategy called defense in depth. This strate
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!