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
nevsk [136]
2 years ago
11

A loop that will output every other name in the names list.

Computers and Technology
1 answer:
Nuetrik [128]2 years ago
4 0

Answer:

names = ['Peter', 'Bruce', 'Steve', 'Tony', 'Natasha', 'Clint', 'Wanda', 'Hope', 'Danny', 'Carol']

numbers = [100, 50, 10, 1, 2, 7, 11, 17, 53, -8, -4, -9, -72, -64, -80]

for index, element in enumerate(names):

if index % 2 == 0:

 print(element)

for num in numbers:

 if num >= 0:

   print(num, end = " ")

count = 0

for i in numbers:

 count += i

avg = count/len(numbers)

print("sum = ", count)

print("average = ", avg)

for num in numbers:

 if num % 2 != 0:

   print(num, end = " ")

Explanation:

I'm stuck on the last two.. I have to do those too for an assignment.

You might be interested in
The term embedded system refers to any device that includes a computer chip, but that is not a general-purpose workstation, desk
user100 [1]

 Any electronic system that uses a computer chip, but that is not a general-purpose workstation, desktop or laptop computer. Such systems use microcontrollers (MCUs) or microprocessors (MPUs), or they may use custom-designed chips.

4 0
2 years ago
Software is:
irakobra [83]
I think the answer is A
7 0
3 years ago
Bends are made in pvc conduit using a tool known as a
USPshnik [31]
The answer is C) heater box
8 0
2 years ago
Read 2 more answers
Write a python program to read four numbers (representing the four octets of an IP) and print the next five IP addresses. Be sur
sdas [7]

Answer:

first_octet = int(input("Enter the first octet: "))

second_octet = int(input("Enter the second octet: "))

third_octet = int(input("Enter the third octet: "))

forth_octet = int(input("Enter the forth octet: "))

octet_start = forth_octet + 1

octet_end = forth_octet + 6

if (1 <= first_octet <= 255) and (0 <= second_octet <= 255) and (0 <= third_octet <= 255) and (0 <= forth_octet <= 255):

   for ip in range(octet_start, octet_end):

       forth_octet = forth_octet + 1

       if forth_octet > 255:

           forth_octet = (forth_octet % 255) - 1

           third_octet = third_octet + 1

           if third_octet > 255:

               third_octet = (third_octet % 255) - 1

               second_octet = second_octet + 1

               if second_octet > 255:

                   second_octet = (second_octet % 255) - 1

                   first_octet = first_octet + 1

                   if first_octet > 255:

                       print("No more available IP!")

                       break

       print(str(first_octet) + "." + str(second_octet) + "." + str(third_octet) + "." + str(forth_octet))

else:

   print("Invalid input!")

Explanation:

- Ask the user for the octets

- Initialize the start and end points of the loop, since we will be printing next 5 IP range is set accordingly

- Check if the octets meet the restrictions

- Inside the loop, increase the forth octet by 1 on each iteration

- Check if octets reach the limit - 255, if they are greater than 255, calculate the mod and subtract 1. Then increase the previous octet by 1.

For example, if the input is: 1. 1. 20. 255, next ones will be:

1. 1. 21. 0

1. 1. 21. 1

1. 1. 21. 2

1. 1. 21. 3

1. 1. 21. 4

There is an exception for the first octet, if it reaches 255 and others also reach 255, this means there are no IP available.

- Print the result

8 0
3 years ago
What text structure this is
jasenka [17]

Compare And Contrast.

6 0
2 years ago
Other questions:
  • What is the output of the following program?
    8·1 answer
  • In the two-level directory, if a user refers to a particular file then__________________ Select one: a. only his/her own UFD (us
    7·1 answer
  • How to burn mp3 on dvd
    13·2 answers
  • Your boss is very skeptical about the idea of storing his files up in the cloud rather than on a local storage drive. He asks yo
    7·1 answer
  • What is the meaning of delegation
    13·2 answers
  • Mac or PC (need opinions please)<br><br> Why did you choose Mac/PC?
    10·2 answers
  • The list method reverse reverses the elements in the list. Define a function named reverse that reverses the elements in its lis
    10·1 answer
  • Coding 5 - Classes The Item class is defined for you. See the bottom of the file to see how we will run the code. Define a class
    13·1 answer
  • A student will not be allowed to sit in exam if his/her attendance is less than 75% .
    8·1 answer
  • You are asked to write a program that prompts the user for the size of two integer arrays, user input for the size must not exce
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!