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
Yet another variation: A better packet switched network employs the concept of acknowledgment. When the end user’s device receiv
dlinn [17]

Answer:

a. see explaination

b. 0.632

Explanation:

Packet switching is a method of grouping data that is transmitted over a digital network into packets. Packets are made of a header and a payload.

See attachment for the step by step solution of the given problem.

7 0
3 years ago
Write a function maxTemp which takes a filename as string argument and returns the maximum temperature as float type for the wee
Alenkinab [10]

Answer:

#section 1

def maxTemp(filename):

   import pathlib

   f = pathlib.Path(filename)

   f.exists()

   if f.exists():

       f = open(filename, "r")

#section 2

       next(f)

       res = [int(sub.split(',')[1]) for sub in f]

       maxdata = (res[0])

       for i in range(len(res)-1):

           if maxdata < res[i]:

               maxdata = res[i]

       

       index = res.index(maxdata)

       f.close()

 #section 3  

       li = []  

       a = open(filename, "r")

       for line in a:

           line = line.strip()

           li.append(line)

   

       

       a.close()

       return (li[index+1])

   else:

       return -1

print(maxTemp("new.csv"))

Explanation:

#section 1:

The function maxTemp is defined. We import pathlib in other to check if the file exists, if it does we carry on with opening the file and if it doesn't the program returns -1.

#section 2:

We start splitting the sub-lists from the second line i.e <em>next(f)</em>. For each line we take the second index element and convert it to an integer.

<em>res = [int(sub.split(',')[1]) for sub in f] </em>

The maximum number is gotten by using the if statement to compare all elements in the list.  The index of the maximum item in the list is collected.

the file is then closed.

#section 3  :

The file is re-opened and all the lines are striped and passed into a new list and the index recovered from section 2, is used to get the day with the highest temperature and the line is returned.

8 0
3 years ago
Susie works for an architectural firm and the partners have always drawn the plans for projects by hand. Though Susie learned ho
Nookie1986 [14]

Answer:

A. CAD

Explanation:

Computer Aided Design, CAD, is basically for design. It involves the use of a computer to assist in the process of designing a part, circuit, building, etc.

It is also for drafting, here it makes use of a computer to assist in the process of communicating a technical drawing.

CAD has a couple of models in which its drawings and designs are represented. namey;

Solid Modeling: This is a type of 3D CAD process in which volumes of an object are represented not just its lines and surfaces.

Wireframe Modeling: This is a 3D CAD process that represents the lines and surfaces of a design.

Additive Modeling: This is a 3D modelling method in which each component is created individually and subsequent components are created as needed. This method is represented by construction processes such as welding, gluing, mechanical fastening, joinery.

Subtractive Modeling: This is a 3D modelling method in which a design is created by removing different geometric shapes from a solid block larger than the final design. The method is can best be represented by milling, drilling, turning, grinding, and other manufacturing processes.

Susie can make use of CAD and pitch its importance to his clients.

8 0
2 years ago
What command launches the remote desktop client for windows?
Ksju [112]
%windir%\system32\mstsc.exe

launches the RDP client.
7 0
3 years ago
Name two components required for wireless networking<br>(answer fastly)​
Luden [163]

Explanation:

User Devices. Users of wireless LANs operate a multitude of devices, such as PCs, laptops, and PDAs. ...

Radio NICs. A major part of a wireless LAN includes a radio NIC that operates within the computer device and provides wireless connectivity.

or routers, repeaters, and access points

5 0
2 years ago
Other questions:
  • Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database. Give INSERT and UPDATE p
    8·1 answer
  • While a hard drive is running, even a slight bump against the computer may cause the
    9·2 answers
  • What is an effective way to assess user requests for additional features and functions
    10·1 answer
  • Match the terms with their definitions.
    5·2 answers
  • A _____ is a climate-controlled building or set of buildings that houses database servers and the systems that deliver mission-c
    6·1 answer
  • .____________ is a way to identify and differentiate goods andservices through use of a name or distinctive design element.
    10·1 answer
  • The Coins class was created to hold all your loose change, kind of like a piggy bank! For this exercise, you are going to simula
    15·1 answer
  • How would you build a robot
    7·2 answers
  • Help101111 avatar can we be friend's please? My name is Keegan. what is yours?
    12·1 answer
  • when inserting a bibliography one choose from multiple ______ of bibliographies.[insert Bibliography]
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!