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
sergiy2304 [10]
3 years ago
15

Write a program that reads numbers from the user until a blank line is entered. Your

Computers and Technology
1 answer:
ddd [48]3 years ago
5 0

Answer:

nums = []

while True:

   in = input()

   if in:

       nums.append(in)

   else:

       break

if nums:

   avg = sum(nums) / len(nums)

   for i in range(len(nums)):

       if nums[i] == avg:

           print(f"index: {i+1}")

           print(nums[i])

else:

   print(-1)  # if there aren't any values in nums

Explanation:

Assuming that you are coding in Python 3x. The last 'else' statement is an edge case that you might want to consider, I don't know what you want to put there, but I'm just going to leave it as -1.

You might be interested in
Bunco is a dice throwing game that requires no decisions to be made or skill on the part of the player just luck. In the simples
anygoal [31]
Abcdefghijklmnopqrstuvwxyz now I know my abcs, next time won’t you sing with me :)
8 0
2 years ago
The most direct way for Jonothan to gain on-the-jib experience and earn money while attending school is to apply for
Sholpan [36]
A part-time job would provide on-the-job experience while also giving him a flexible schedule competing with school.
4 0
3 years ago
Considering the traffic problem, do you think Rod handled the situation well?
svet-max [94.6K]
No he did not that was a poor choice.
7 0
3 years ago
PLS HELP ME I HAVE NO TIME
melisa1 [442]
Please Help! Unit 6: Lesson 1 - Coding Activity 2
Instructions: Hemachandra numbers (more commonly known as Fibonacci numbers) are found by starting with two numbers then finding the next number by adding the previous two numbers together. The most common starting numbers are 0 and 1 giving the numbers 0, 1, 1, 2, 3, 5...
The main method from this class contains code which is intended to fill an array of length 10 with these Hemachandra numbers, then print the value of the number in the array at the index entered by the user. For example if the user inputs 3 then the program should output 2, while if the user inputs 6 then the program should output 8. Debug this code so it works as intended.

The Code Given:

import java.util.Scanner;

public class U6_L1_Activity_Two{
public static void main(String[] args){
int[h] = new int[10];
0 = h[0];
1 = h[1];
h[2] = h[0] + h[1];
h[3] = h[1] + h[2];
h[4] = h[2] + h[3];
h[5] = h[3] + h[4];
h[6] = h[4] + h[5];
h[7] = h[5] + h[6];
h[8] = h[6] + h[7]
h[9] = h[7] + h[8];
h[10] = h[8] + h[9];
Scanner scan = new Scanner(System.in);
int i = scan.nextInt();
if (i >= 0 && i < 10)
System.out.println(h(i));
}
}
6 0
3 years ago
For the following data, what is the average number of cycles per instruction?
Komok [63]

Answer:

2.82

Explanation:

The computation of the average number of cycles per instruction is shown below:

=  Arithmetic/logical operations × frequency cycles + Register load operations ×  frequency cycles  + Register store operations  ×  frequency cycles + Unconditional branch instructions ×  frequency cycles + Conditional branch instructions ×  frequency cycles

=  45% × 1 + 18% × 5 + 10% × 2 + 7% × 1 + 20% × 6

= 0.45 + 0.9 + 0.2+  0.07 + 1.2

= 2.82

7 0
4 years ago
Other questions:
  • With a(n) ____ structure, you perform an action or task, and then you perform the next action in order.
    6·1 answer
  • In this problem we consider sending real-time voice from Host A to Host B over a packet-switched network (VoIP). Host A converts
    12·1 answer
  • Businesses use a fax cover sheet is to _____. provide detailed service and product information make sure message reaches the rig
    14·2 answers
  • 2. Which of the following best describes the protocols used on the Internet?
    15·1 answer
  • A student opens a recently purchased software package and begins reading the enclosed materials. What information might be inclu
    6·1 answer
  • How do you know if something is in the public domain
    5·1 answer
  • How are computers 35 years ago and how are they presently and how are they going to be in the next 35 years
    9·1 answer
  • Anyone have an answer for 4.9 lesson code practice
    9·1 answer
  • 5.7 AP-Style MC Practice edhessive
    14·1 answer
  • Define operating system?explain the types of operating system on the basis of use.​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!