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
A. Write a program that asks the user to enter an integer, then prints a list of all positive integers that divide that number e
kobusy [5.1K]

Answer:

Following are the program in python language the name of the program is factors.py

num= int(input("Please enter a positive integer: "))#Read the number by user

print("The factors of ",num,"are:")

for k in range(2,num): #iterating over the loop

   if(num%k==0): #checking the condition

       print(k)#display the factor

Output:

Please enter a positive integer: 12

The factors of 12 are:

2

3

4

6      

Explanation:

Following are the description of the program

  • Read the number by user in the "num" variable
  • Iterating the for loop from k=2 to less then "num".
  • In the for loop checking the factor of "num"  variable by using % operator.
  • Finally display the factor by using print function
4 0
3 years ago
Select the correct answer from each drop-down menu. Computer memory stores data as a series of 0s and 1s. In computer memory, re
attashe74 [19]

Answer:

Zero (0); one (1).

Explanation:

Boolean logic refers to a theory of mathematics developed by the prominent British mathematician, called George Boole. In Boolean logic, all variables are either true or false and are denoted by the number "1" or "0" respectively; True = 1 or False = 0.

The memory of a computer generally stores data as a series of 0s and 1s. In computer memory, zero (0) represents the absence of an electric signal i.e OFF and one (1) represents the presence of an electric signal i.e ON.

4 0
3 years ago
When did economies begin?
Pavlova-9 [17]
They began in ancient times the babylons started trading
6 0
3 years ago
Read 2 more answers
What is it called when you make predictions within given data?
denis23 [38]
<span>When a researcher uses given data to make a prediction, this is known as a hypothesis. The hypothesis generally serves as a starting point for future research, allowing a researcher to further develop their theory through additional testing, observation, and, if necessary, revision to the current hypothesis.</span>
4 0
3 years ago
Making phone calls with a public box
AfilCa [17]

Answer:

ja ok it is so eassssy.........................

8 0
3 years ago
Other questions:
  • Under which menu option of a word processing program does a star appear
    8·1 answer
  • Explain briefly why every person in the world is not connected to the Internet.
    9·1 answer
  • Please help. 15 points!!!!
    8·2 answers
  • I want pizzzzzzzaaaaaaaaaaa
    9·1 answer
  • What two pieces of information would you need in order to measure the masses of stars in an eclipsing binary system?
    9·1 answer
  • In an experiment in which participants sat in an office and then were asked to remember what they saw in the office, participant
    6·1 answer
  • What part of the meat help you identify the less tender cuts​
    13·1 answer
  • Sally has 4 quarters, 2 dimes, 6 nickels, and 10 pennies.
    13·2 answers
  • You are now going to prepare some reports for the company. Measurements are in metres and volume
    7·1 answer
  • What type of computer is IBM 1401 ?<br><br>​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!