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
Nitella [24]
3 years ago
14

4.3 mini programs AP computer science

Computers and Technology
1 answer:
allochka39001 [22]3 years ago
8 0

1.

name = input("Enter your name: ")

num1 = int(input("Hello "+name+ ", enter an integer: "))

num2 = int(input(name+", enter another integer: "))

try:

   if num1 % num2 == 0:

       print("The first number is divisible by the second number")

   else:

       print("The first number is not divisible by the second number")

except ZeroDivisionError:

   print("The first number is not divisible by the second number")

try:

   if num2 % num1 == 0:

       print("The second number is divisible by the first number")

   else:

       print("The second number is not divisible by the first number")

except ZeroDivisionError:

   print("The second number is not divisible by the first number")

2.

import random, math

num1 = float(input("Enter a small decimal number: "))

num2 = float(input("Enter a large decimal number: "))

r = round(random.uniform(num1, num2), 2)

print("The volume of a sphere with radius " + str(r) + " is " + str(round(((4 / 3) * math.pi * (r ** 3)), 2)))

I hope this helps!

You might be interested in
50 POINTS!!!!!!!!!!!<br><br> Give at least two examples of how the transport layer is used.
anyanavicka [17]

Answer:

The transport layer is responsible for delivering data to the appropriate application process on the host computers. Some transport layer protocols, for example TCP, but not UDP, support virtual circuits, i.e. provide connection-oriented communication over an underlying packet-oriented datagram network.

Explanation:

Some transport layer protocols, for example TCP, but not UDP, support virtual circuits, i.e. provide connection-oriented communication over an underlying packet-oriented datagram network.

7 0
3 years ago
Read 2 more answers
What study skill is being used when taking a large project and breaking it down into smaller manageable tasks?
Lostsunrise [7]
Not sure but I think it’s called prioritizing
6 0
2 years ago
Read 2 more answers
Why is it important to minimize cable clutter in a rack?
V125BC [204]

Answer: Cable clutter is the mess created due to cables of the operating system units in the rack.The reduction in the cable clutter is important because it make the computing environment clear and prevent the blockage in flow of air, reducing the litter in rack environment etc  

The clearance of the cable clutter can be done with the help of cable managers for collecting the cables and tying them into one section, organizing and clearing the cabinets of rack.

8 0
3 years ago
While engineers work to create computers that can understand us emotionally, ________ are also evolving toward a more human appe
aleksandrvk [35]
While engineers work to create computers that can understand us emotionally, ________ are also evolving toward a more human appearance.

affecting computing techniques
8 0
3 years ago
Chegg Suppose the heap is a full tree, size 2^n-1. what is the minimum number of steps to change a min heap to a max heap. Show
adoni [48]

Answer:

Explanation:

We start from the bottom-most and rightmost internal node of min Heap and then heapify all internal modes in the bottom-up way to build the Max heap.

To build a heap, the following algorithm is implemented for any input array.

BUILD-HEAP(A)

   heapsize := size(A)

   for i := floor(heapsize/2) downto 1

       do HEAPIFY(A, i)

   end for

Convert the given array of elements into an almost complete binary tree.

Ensure that the tree is a max heap.

Check that every non-leaf node contains a greater or equal value element than its child nodes.

If there exists any node that does not satisfy the ordering property of max heap, swap the elements.

Start checking from a non-leaf node with the highest index (bottom to top and right to left).

4 0
3 years ago
Other questions:
  • A flowchart would be an example of what kind of programming?
    12·1 answer
  • Your computer running Windows 7 is doing some very strange things with the operating system. You are fairly certain it is not a
    10·1 answer
  • What is the definition of a WAP?
    6·2 answers
  • Which registry hive is loaded first during windows startup?
    5·1 answer
  • A slideshow that accompanies an oral report is known as what?
    6·1 answer
  • 20 points
    6·2 answers
  • A program uses two classes: dog and poodle. which class is the base class and which is the derived class?
    7·2 answers
  • It is where your cpu (processor) is installed
    10·2 answers
  • When would the Jerusalem virus attack?<br> 1. Friday the 13th<br> 2. Wednesday the 13th
    13·2 answers
  • How do we Rewrite the following Python code to avoid error. mark=inpt("enter your mark ")
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!