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
pogonyaev
3 years ago
14

Given 3 floating-point numbers. Use a string formatting expression with conversion specifiers to output their average and their

product as integers (rounded), then as floating-point numbers. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('%0.2f $ your_value)
Ex: If the input is:
10.3
20.4
5.0
the output is:
11 1050
11.90 1050.60
Computers and Technology
1 answer:
jarptica [38.1K]3 years ago
5 0

Answer:

Following are the program in the Python Programming Language.

#get input from the user

x = float(input())

#get input from the user

y = float(input())

#get input from the user

z = float(input())

#find the average  

average =(x+y+z)/3

#find the product  

product = x*y*z

#print the result in given format

print('\n%d %d'%(average,product))

#print the result in given format

print('%0.2f %0.2f'%(average,product))

Explanation:

<u>Following are the description of the program</u>:

  • We set three variables 'x', 'y', and 'z' that accept float type values from the user.
  • Then, set variable 'average' that store the average of the following values that is given by the user.
  • Set variable 'product' that store the multiplication of the following values that is given by the user.
  • Finally, we print the average and the product in the following format  that is given in the statement.
You might be interested in
Provide your own examples of the following using Python lists. Create your own examples. Do not copy them from another source. N
leonid [27]

Lists are used in Python to hold multiple values in one variable

<u>(a) Nested list</u>

A nested list is simply a list of list; i.e. a list that contains another list.

It is also called a 2 dimensional list.

An example is:

nested_list = [[ 1, 2, 3, 4]  , [ 5, 6, 7]]

<u>(b) The “*” operator </u>

The "*" operator is used to calculate the product of numerical values.

An example is:

num1 = num2 * num3

<u>List slices </u>

This is used to get some parts of a list; it is done using the ":" sign

Take for instance, you want to get the elements from the 3rd to the 5th index of a list

An example is:

firstList = [1, 2 ,3, 4, 5, 6, 7]

secondList = firstList[2:5]

<u>The “+=” operator </u>

This is used to add and assign values to variables

An example is:

num1 = 5

num2 = 3

num2 += num1

<u>A list filter </u>

This is used to return some elements of a list based on certain condition called filter.

An example that prints the even elements of a list is:

firstList = [1, 2 ,3, 4, 5, 6, 7]

print(list(filter(lambda x: x % 2 == 0, firstList)))

<u>A valid but wrong list operation</u>

The following operation is to return a single list, but instead it returns as many lists as possible

def oneList(x, myList=[]):

   myList.append(x)

   print(myList)

oneList(3)

oneList(4)

Read more about Python lists at:

brainly.com/question/16397886

6 0
2 years ago
A teacher wants a program to give extra points to students who fail a test. Write a Python program to do the following: (a) Ask
Lorico [155]

Answer:

Hi there! Please find the answer below.

Explanation:

The program below demonstrates how each of the requirements can be coded in a simple Python script. To copy the array, we can use the copy() method of the array. To calculate the diff, we can use a few different techniques, so I have implemented it using a loop over the arrays and just storing and displaying the difference in the 2 arrays.

new_string.py

def add_test_score(score):

 test_score.append(score);

contact_hash = {}

test_score = []

print("Enter 5 test scores: ");

for x in range(0, 5):

   input_string = input("Enter test score " + str(x + 1) + ": ")

   add_test_score(int(input_string));

print(test_score);

test_score_copy = test_score.copy();

for e in test_score_copy:

   if e < 60:

       test_score_copy[test_score_copy.index(e)] += 10;

diff = [];

for e in test_score:

   print(test_score[test_score.index(e)]);

   print(test_score_copy[test_score.index(e)]);

   if not test_score[test_score.index(e)] == test_score_copy[test_score.index(e)]:

       diff.append(e);

print(diff);

8 0
3 years ago
What is the reason for taking care of design a good computer human interface ​
anygoal [31]

Answer:

computer is one of the part of our technology so that let's take care of it and improve so that we can used for better and sufficient ly not maybe now but maybe soon.

3 0
3 years ago
Read 2 more answers
To achieve the maximum confidentiality and integrity found in a completely secure information system would require that the syst
fgiga [73]

Answer:

The answer is "Option a".

Explanation:

Privacy is a set of rules, which limiting access to the data, and integrity ensures impartiality, accuracy, and reliability is assured to ensure, which authorized persons can have secure access to the data.

The system needs no access for everyone to achieve its secrecy and integrity contained in a completely safe data system, that's why the given statement is "true".

5 0
3 years ago
People are still buying printed magazines?
BARSIC [14]
Yes, they are. 
Mostly dentists' offices, though.  
3 0
3 years ago
Other questions:
  • A hard drive that is running slowly may not have been
    10·2 answers
  • In this website/app what are the points for?
    7·1 answer
  • Advantage and disavantage of malware maintenance
    12·1 answer
  • To generate a report with exact results based on specific criteria it is best to base the report on a(n) ____________________ cr
    6·1 answer
  • Which two statements are true about the Data Sync functionality? (Choose two.)
    15·1 answer
  • Nuclear batteries use devices called thermocouples, which convert the ____ of a nuclear reaction into electricity.
    9·1 answer
  • Assume that a 5 element array of type string named boroughs has been declared and initialized. Write the code necessary to switc
    5·1 answer
  • Looking for friends, anyone up for it?
    12·2 answers
  • I have a very quick question. So im applying for Early college and i need some future educational goals and maybe im just thinki
    6·1 answer
  • Type the correct answer in the box. Spell the word correctly. A company has its branches spread over five places in a state. It
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!