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
Do you believe that oop should be phased out and we should start working on some alternative?
Ksju [112]
I don’t think we should because we all have our one choices that we should achieved and we should show
5 0
3 years ago
Use the code below to answer the following questions. Note that the catch statements in the code are not implemented, but you wi
anzhelika [568]

Answer:

d) either e1 or e5

Explanation:

Here, the instruction i1 goes ahead in trying to open the given file through an input stream buffer reader. If the given file name is wrong, it will indicate that an e1 file is not found or if any other IO errors due to invalid stream, no disc in drive e5 IO exception will be drawn.

4 0
3 years ago
Which would you use to get the number of elements in a dictionary?
Vikentia [17]

The function use to get the number of element in a dictionary is len.

<h3>What is a dictionary?</h3>

Dictionaries are used to store data values in key-value pairs. Dictionary are ordered.

Dictionary in python are express as follows:

my_dict = {"name": "Michael", "age": 28, "school": "Oxford"}

Therefore, the length of the element of the dictionary can be gotten using the len() function.

Hence,

print(len(my_dict)) will give you the length of the element.

learn more on dictionary here: brainly.com/question/14120893

#SPJ11

8 0
1 year ago
When web developers specify color values for text or backgrounds, they often represent RGB (red-green-blue) colors using a six-d
neonofarm [45]

Answer: A #3f107f.

Letter B would produce a lighter blue-purple color rather than a darker shade of purple. Letter C would produce a very light purple color. Letter D would produce a Black color, making it very dark and not in the range of being purple.

Letter A would produce a darker shade of purple. As explained in the way that the RGB color hexadecimal uses, the amount of each respective color is 2 digits for each color Red, Green, Blue respectively.  By reducing the amount of each color in the RGB mode, the output will become a darker shade as the RGB mode is an ADDITITIVE type of color mode.

7 0
3 years ago
__________for about 10 minutes in between each repetition session helps you to remember the information better. a. Reading c. Sl
k0ka [10]

the answer is a.) reading

6 0
2 years ago
Read 2 more answers
Other questions:
  • Given the following code, what is output by the method call, mystery(6 * 8)?
    8·1 answer
  • What video game has made the most money as of 2016?
    15·2 answers
  • When designing a suitable and safe flexibility training program, you should set reasonable and appropriate goals depending on wh
    15·1 answer
  • Consider a system consisting of m resources of the same type, being shared by n processes. Resources can be requested and releas
    13·1 answer
  • Two machines can finish a job in StartFraction 20 Over 9 EndFraction hours. Working​ alone, one machine would take one hour long
    10·1 answer
  • Ian kno da answer tell me
    7·2 answers
  • How do computer users benefit from the increased speed?
    9·1 answer
  • Match the context details with the pattern that applies.
    7·1 answer
  • Write the definition of a function that evaluates three double numbers and returns true if the floor of the product of the first
    8·1 answer
  • _________________ uses soap or detergent to physically remove germs, dirt, and impurities from surfaces or objects.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!