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
valina [46]
2 years ago
10

Write a Python program to do the following: (a)Use a for loop and a random integer generator to generate 5 random integers in 1

to 9. Store the random integers in a list. Display the list. (b)Use a for loop and a random integer generator to generate 5 random integers in 2 to 8. Store the random integers in a second list. Display the second list. (c)Use a for loop to compare elements in the two lists in pairs, i.e., compare the first elements in both lists, compare the second elements in the both lists, etc. Display the larger number in each comparison. The following is an example. There is no user input in this program.
Computers and Technology
1 answer:
Andrei [34K]2 years ago
6 0

Answer:

//program in Python

#library

import random

#part 1

#empty list 1

list1 = []  

#Generate 5 random numbers for the first list

for i in range(0, 5):

   list1.append(random.randrange(1, 9+1))

#print first list

print("First List: " + str(list1))

#part b

#empty list 2

list2 = []  

#Generate 5 random numbers for the second list

for i in range(0, 5):

   list2.append(random.randrange(2, 8+1))

 

#print the second list

print("Second List: " + str(list2))

#part c

#Compare each element from both  lists and print the larger one

print("Larger number in each comparison:")

for i in range(0, len(list1)):

   if list1[i] >= list2[i]:

       print(list1[i])

   else:

       print(list2[i])

Explanation:

Create an empty list.Generate 5 random number from range 1 to 9 and append them  into first list.Create a second empty list.generate 5 random numbers from range  1 to 8 and append them into second list.Print both the list.Then compare both the list an print Larger in each comparison.

Output:

First List: [3, 1, 4, 9, 8]                                                                                                

Second List: [5, 8, 2, 7, 6]                                                                                              

Larger number in each comparison:                                                                                          

5                                                                                                                          

8                                                                                                                          

4                                                                                                                          

9                                                                                                                          

8  

You might be interested in
How the data is converted into the information?​
leonid [27]

Answer:

the data is converted into information by data processing

7 0
3 years ago
Read 2 more answers
When describing memory, ____________ is the first component required in the process necessary for retention?
8_murik_8 [283]
Depends on how deep you're willing to go to really,
You need one of a few arrangements of flip flop circuits to keep 1-bit state.
Going deeper, you need either NAND, or NOR gates(or a bunch of other ones) and connectors.
Even deeper, you'll require diodes or transistors to build the logic gates.
Beyond that is particle physics.
8 0
3 years ago
Who conceptualizes the design and the working of a website
Citrus2011 [14]
Answer is "Web Designer".

Web Designers are the "artists" of the website. They conceptualize the layout and functionality of the site, from features to format. They may do little coding, and are mostly involved in the creative elements of web design. The Web Developer is less big-picture, and more knitty-gritty building of the website. She is the one who does the coding and actually builds the website, using the web designer's model. 
3 0
3 years ago
What are the main techniques used to help manage test anxiety? Check all that apply.
Aleks04 [339]

Answer:

1) Avoid the perfectionist of trap

2)Banish the negative thoughts

3) Get enough sleep

4) Make sure you are prepared

5) take deep breaths

Explanation:

In my thought it's the answer of this question.

4 0
2 years ago
Read 2 more answers
In case of a suspected data breach, what course of action should a chief information security officer (CISO) take
guapka [62]

Answer

1. Assemble his team

2. Find reason for breach

3. Evaluate what was lost

4. Ensure password change

Explanation:

In case of a suspected breach, the Chief information security officer should first of all assemble his incidence response team. This team should have representatives from all areas of the organization.

Then the reason for the breach and how access was gained has to be found out. An evaluation of what has been lost in the breach would be carried out and it's likely impact on the company.

In case credentials were stolen the CISO has to ensure that the employees change passwords. Also he has to notify all the necessary parties about the breach.

The CISO has to ensure that all employees are trained properly on security and they comply to security policies.

7 0
3 years ago
Other questions:
  • Which of the following Internet protocols is MOST important in reassembling packets and requesting missing packets to form compl
    11·1 answer
  • A _______________ is a security threat that may launch a worm through a Trojan horse or launch a denial-of-service attack at a t
    10·1 answer
  • HELPPPP PLEASE HURRY
    15·1 answer
  • Computer can do work very___​
    7·2 answers
  • Cursor/Blinking line is used to show current_ on document. A- Color b- Status c- Type d- Location
    11·1 answer
  • What can you use on Code.org's Web Lab to find and fix problems when you are writing code for your website?
    13·1 answer
  • What part of the meat help you identify the less tender cuts​
    13·1 answer
  • Hi um... i just wanna say hi :P
    6·2 answers
  • What are basic types of touch screen
    15·2 answers
  • What do you mean by computer ethics?​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!