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]
3 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]3 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
Describe any four rights of users of information systems.
riadik2000 [5.3K]

Four Rights of users of information system are the following;

<span>·         </span>Protection from viruses, worms and other threats

<span>·         </span>User should have an effective training

<span>·         </span>The user should have a reliable system development as well as maintenance

<span>·         </span>The user should have a computing environment

8 0
4 years ago
what is a paragraph on what i can write on what i learned from watching basic keyboard shortcuts using control functions video
finlep [7]

Answer:

Write the following nonsensical paragraph:

Explanation:

I learned how to navigate the computer efficiently. I learned how to use Ctrl + (key) to quickly do (something). ( Now reword that multiple times with different commands. ) Now I can harness my inner laziness to browse the computer at a faster speed.

6 0
4 years ago
Im confused sorry.. can i get help?
garik1379 [7]

1.

If-then statements are used in a program to run certain code when ideal conditions are met.

2.

Since the variable word holds the word kangaroo and the if statement is asking if the variable word is equal to KANGAROO, the else statement will run. The output will be FALSE

3.

if (90 < = x <= 100) should be rewritten as Nothing, the if statement is correct.

4.

You use an else statement when you want your code to do something if your if statement is false.

5.

if (num1 != num2)

I hope this helps!

7 0
3 years ago
Dropbox is an example of ________. Bluetooth technology optical storage SSD technology cloud storage
inessss [21]

IaaS

Laas is Framework as a help are online administrations that give significant level APIs used to dereference different low-level subtleties of basic organization foundation like actual registering assets, area, information dividing, scaling, security, reinforcement and so forth

7 0
3 years ago
owever, sitting in a corner of the store, a hacker had just set up an open "rogue" wireless hotspot posing as the coffee shop’s
Ivenika [448]

However, sitting in a corner of the store, a hacker had just placed up an open “rogue” wireless hotspot posing as the coffee shop’s wireless network. When Sarah logged onto her bank’s website, the hacker hijacked her session and gained access to her bank accounts. Another term for rogue wireless hotspots exists as “evil twin” hotspots.

<h3>What is meant by wireless network?</h3>

A computer network is referred to as a wireless network if radio frequency (RF) links are used to connect network nodes. A common solution for households, companies, and telecommunications networks is wireless networking. Wi-Fi is a wireless networking technology that enables printers and video cameras to connect to the Internet as well as computers (laptops and desktops), mobile devices (smart phones, wearables, etc.), and other devices.

Increased Mobility: Wireless networks give mobile users access to real-time data, enabling them to move freely across the premises of your firm without losing network connectivity. This improves collaboration and production across the entire organisation, which is not achievable with traditional networks.

Hence, However, sitting in a corner of the store, a hacker had just placed up an open “rogue” wireless hotspot posing as the coffee shop’s wireless network. When Sarah logged onto her bank’s website, the hacker hijacked her session and gained access to her bank accounts. Another term for rogue wireless hotspots exists as “evil twin” hotspots.

To learn more about wireless network refer to:

brainly.com/question/26956118

#SPJ4

6 0
1 year ago
Other questions:
  • Depending on the manufacturer of the bios, what two different post beep code sequences indicate a memory error?
    11·1 answer
  • What type of scientists studies tree rings to determine the history of an area?
    9·2 answers
  • What is the maximum number of columns in a spreadsheet that you can sort in one instance in software like OpenOffice Calc?
    7·2 answers
  • Invention I chose was radio.
    9·1 answer
  • Differentiate between the broadcasting and telecommunication
    5·1 answer
  • Which of the following are examples of how a company might use consumer data it had collected? a To decide what types of product
    10·1 answer
  • What are some disadvantages of using a word processor over a type writer?​
    7·1 answer
  • How to change my age on this app
    10·2 answers
  • Emanuel studies hard for hours on end until bedtime, yet his grades could be better. What can he do to improve his academic perf
    6·1 answer
  • The best team in nba like right now
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!