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
Alinara [238K]
3 years ago
15

Write a program that asks the user to enter two integer numbers X and Y. The program halves each number between X and Y then pri

nts the values on the screen. For example: If X=5 and Y=7, the program prints the following values 5/2=2.5, 6/2=3.0 and 7/2=3.5 Sample run 1: Enter X and Y: 5 7 2.5 3 3.5 Sample run 2: Enter X and Y: 15 10 5.0 5.5 6.0 6.5 7.0 7.5

Computers and Technology
1 answer:
QveST [7]3 years ago
5 0

Answer:

`I wrote a quick script in Python, to get you started a little basic and doesn't cover much but it works

Explanation:

starting off x = input(...) and y = input(...) is simply grabbing the input from the users then I make a base array vals defined like:

vals = []

to store the calculated results

rx = int(x) and ry = int(y), are simply converting the x, y which are strings into a int type, so I can use them on this line:

for i in range(rx, (ry + 1)):

I added the + 1 to ry because the range ends at the number before Y, example:

for i in range(5, 8):

 print(i) -> 5,6,7

with all of that I simply ran an iteration <em>for loop</em> and calculated and store the results into vals presented here:

vals.append(i / 2)

If there's any confusion leave a comment I'll try my best to help out

You might be interested in
Tristan has moved the Television and related equipment
madreJ [45]

Answer:

1: C

2: B

3: A

Explanation:

6 0
3 years ago
write a program, using python, to determine the mean, median, and standard deviation of a list of numbers. In addition, count th
Mekhanik [1.2K]

Answer:

The program to this question can be given as:

Program:

import math   #import packages

import sys

number =  [3, 6, 7, 2, 8, 9, 2, 3, 7, 4, 5, 9, 2, 1, 6, 9, 6]  #define list  

n = len(number)   # taking length of list

print("Sample Data: ",number)  #print list

#find Mean

print("Mean is: ")  #message  

add = sum(number)  # addition of numbers.

mean = add / n  #add divide by total list number.

print(str(mean))  #print mean

number.sort()   #short list by using sort function

#find Median

print("Median is: ")

if n % 2 == 0:        #conditional statement.

   median1 = number[n//2]  

   median2 = number[n//2 - 1]  

   median = (median1 + median2)/2

else:  

   median = number[n//2]  

print(str(median)) #print median

#find Standard deviation.

print("Standard Deviation :")

def SD(number):  #define function SD

   if n <= 1:      #check condition

       return 0.0   #return value.

   mean,SD = average(number), 0.0  

   # find Standard deviation(SD).

   for j in number:

       SD =SD+(float(j)-mean)**2

       #calculate Standard deviation holing in variable SD  

       SD =math.sqrt((SD)/float(n-1))#using math sqrt function.

   return SD  #return value.

def average(av):         #define function average

   n,mean =len(av), 0.0  

   if n <= 1:

       return av[0]   #return value.

   # calculate average

   for I in av:

       mean +=float(i)

       mean /= float(n)

   return mean             #return value.

print(SD(number)) #print value

Output:

Sample Data:  [3, 6, 7, 2, 8, 9, 2, 3, 7, 4, 5, 9, 2, 1, 6, 9, 6]

Mean is:  

5.235294117647059

Median is:  

6

Standard Deviation :

2.140859045465338

Explanation:

In the above python program first, we import packages to perform maths and other functions. Then we declare the list that is number in the list the elements are given in the question. Then we declare variable n in this variable we take the number of elements present in the list and print the list first. In the list, we perform three operations that can be given as:

Mean:  

In the mean operation firstly we define the variable add in this variable we add all elements of the list by using the math sum function then we divide the number by number of elements present in the list. and sore the value in the mean variable and print it.

Median:

In the median section firstly we sort the list by using the sort function. Then we use the conditional statements for calculating median. In the if block first we modules the number by 2 if it gives 0. it calculates first and second median the add-in median .else it will print that number.

Standard Deviation:

In the standard deviation part first, we define two functions that is SD() function and average().In the SD() function we pass the list as the parameter. In this function we use the conditional statement in the if block we call the average() function and use for loop for return all values. In the average() function we calculate the average of the all number and return value. At last, we print all values.

7 0
3 years ago
In BitTorrent, suppose Alice provides chunks to Bob throughout a 30-second interval. Will Bob necessarily return the favor and p
MakcuM [25]

Answer:

It will not necessary that bob will provide chunks to Alice.

Explanation:

Alice has four neighbors of Bob so he will send message to her, but this might not occur if Alice provides chunks to Bob.

Overlay is the network that build at the top of other network.It is a telecommunication network that supported by its own infrastructure.

It encapsulates one packet inside an other packet.

It is a method of creating layers of network that can be used to run multiple virtualized layers on the top pf other network.

It provides new security benefits.

Does Overlay include Routers

Overlay is a file sharing system in which nodes participating and create logical links between them.So overlay network does not include routers.

Edge in overlay

 It is a logical network in which nodes are connected using virtual or logical links.

5 0
3 years ago
Count from 1 to 20(base10) using the following bases: 8, 6, 5, 3.
Licemer1 [7]

Answer:

Base 8:

1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24

Base 6:

1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15, 20, 21, 22, 23, 24, 25, 30, 31, 32

Base 5:

1, 2, 3, 4, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 30, 31, 32, 33, 34, 40

Base 3:

1, 2, 10, 11, 12, 20, 21, 22, 100, 101, 102, 110, 111, 112, 120, 121, 122, 200, 201, 202

Explanation:

When counting on a certain base n you can only use n numerals (including the zero). So, if you count in base 8, you have 8 numrals, these are 0, 1, 2, 3, 4, 5, 6 and 7. The numeral 8 does not exist in base 8 the same as there is no numeral for 10 in base 10. When you're counting beyond the single numerals you add a 1 to the numeral in the column in front (which starts at zero) and reset the previous column.

4 0
3 years ago
Explain how multiple inheritance might cause issues using examples.
allochka39001 [22]

Answer:

For many years, opponents of multiple inheritance have argued that it adds complexity and ambiguity to situations like the "diamond dilemma," in which it's unclear which parent class a certain feature is inherited from if more than one parent class implements the same feature.

Explanation:

6 0
2 years ago
Other questions:
  • Knowing the meaning of the acronym WYSIWYG can be most helpful to you when you
    14·1 answer
  • What is the only language a microprocessor can process directly but most programmers almost never write programs in this code? Q
    12·2 answers
  • Security administrators can use either the PowerShell command line or the graphical user interface of the Server Managerâs Roles
    6·1 answer
  • Carl wants to add a new slide to his PowerPoint presentation. Which option should he use?
    6·2 answers
  • You use_____ to view an XPS file
    6·1 answer
  • My duties included reviewing
    13·1 answer
  • An attacker gained remote access to a user's computer by exploiting a vulnerability in a piece of software on the device. The at
    14·1 answer
  • Write a program that declares a two-dimensional array named myFancyArray of the type double. Initialize the array to the followi
    12·1 answer
  • What is one of four key principles of Responsible Artificial Intelligence
    5·1 answer
  • Noah is creating a startup. He uses the website Upwork to hire freelancers in India and in the Ukraine to work for him. This is
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!