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
sergejj [24]
3 years ago
7

Write a function index(elem, seq) that takes as inputs an element elem and a sequence seq and returns the index of the first occ

urrence of elem in seq. The sequence seq can be either a list or a string. If seq is a string, elem will be a single-character string; if seq is a list, elem can be any value. If elem is not an element of seq, the function should return the length of the sequence. Dont forget that the index of the first element in a sequence is 0. Here are some examples: >>> index(5, [4, 10, 5, 3, 7, 5]) solution
Computers and Technology
1 answer:
Delicious77 [7]3 years ago
5 0

Answer:

def index(elem, seq):

   for i in range(len(seq)):

       if elem == seq[i]:

           return i

   

   return len(seq)

print(index(5, [4, 10, 8, 5, 3, 5]))

Explanation:

Create a function named index that takes elem and seq as parameters

Create a for loop that iterates through the seq. If elem is equal to the item in the seq, return the i, index of the item.

If the elem is not found in the seq, this means nothing will be returned in the loop, just return the length of the seq, len(seq)

Call the function with given parameters and print the result

Note: Since 5 is in the list in the example, the index of the 5 which is 3 will be returned

You might be interested in
The first line of defense against illicit use of, or threats to, computer resources and sensitive information is a strong authen
Ksju [112]

Answer: Authorization process

Explanation

Authorization is a security measure to determine the access levels or user/client rights to use to system resources like files, computer programs, data and other features on a computer. Authorization process is the process of granting or denying access to a network resource that allows the user access to various resources based on the his/her identity.

Most web security systems are based on a two-step Authorization process. The first step ensures and approves the user's identity, that is authentication and the second stage is authorization, which allows the user to access the various resources based on the user's identity.

Therefore the first thing you should do when you suspect "illicit use of, or threats to, computer resources and sensitive information is a strong authentication and authorization process".

5 0
4 years ago
It is the "executable" phrase of Word<br>Wide Web with dynamic applications,?<br>​
Mkey [24]

Answer:

It is the “executable” phrase of Word Wide Web with dynamic applications, interactive services, and “machine-to-machine” interaction. In Web 3.0, computers can interpret information like humans and intelligently generate and distribute useful content tailored to the needs of users.

4 0
3 years ago
Why should running your unit test suites not take a long time?A. Unit tests aren't that important, so less time should be spent
masya89 [10]

Answer:

D. Tests that run too long risk slowing down the feedback cycle for developers

Explanation:

The reason you should run your unit test suites not to take a long time is that "Tests that run too long risk slowing down the feedback cycle for developers."

Otherwise, the developers would find it difficult to detect problems instantly, causing delay to fix the problems which will eventually delay the developers or project's team to advance to the next stage of the project.

3 0
3 years ago
When in global configuration mode, which steps are necessary to edit an ip address on an Ethernet interface?
katrin2010 [14]

Answer:

I. You should enter interface configuration mode.

II. Configure the IP address and subnet mask.

Explanation:

A node refers to the physical device that make up a network and are capable of sending, receiving, creating and storing data in communication.

Some examples of network nodes are modem, hubs, computer, switches, phone and printers.

In Computer networking, network devices such as routers and switches are usually configured (programmed) through the use of specific network commands commonly referred to as configs e.g show int description, config terminal (config t), show IP address, etc.

In Cisco devices, there are five (5) main types of command modes;

1. Sub-interface configuration mode.

2. Interface configuration mode.

3. Line configuration mode.

4. Router configuration method.

5. Global configuration mode.

Global configuration mode is a configuration mode that avail network engineers and end users with the ability to modify or edit the running (global) system configuration of a networking device. Thus, any change effected at the global configuration mode will affect the network device as a whole.

In global configuration mode, the steps which are necessary to edit an ip address on an Ethernet interface include;

I. You should enter interface configuration mode using the "configure terminal" command.

II. Configure the IP address and subnet mask.

See an example below;

"Router(config-if)# IP address 192.168.1.2 255.255.255.0"

4 0
3 years ago
At the very lowest level what data does a computer understand?
kumpel [21]
In fact, at the lowest level, computers only understand sequences of numbers that represent operational codes (op codes for short). On the other hand, it would be very difficult for humans to write programs in terms of op codes
8 0
3 years ago
Other questions:
  • Which argument forces a writer to return to and change the input before resolving a “UnicodeError”?
    10·1 answer
  • Davia draws a shape with 5 sides. two sides are each 5 inches long. two other sides are each 4 inches long. the perimeter of the
    15·1 answer
  • create a 3 to 5 step plan for checking out a post on social media for the next time you encounter something questionable.
    11·2 answers
  • What term is used to describe the time it takes a signal to travel from one location to another on a network?
    13·1 answer
  • You are connected to a server on the Internet and you click a link on the server and receive a time-out message. What layer coul
    12·1 answer
  • Which type of tools enable you to choose only a portion of the image
    13·1 answer
  • The lenght of a formula Can't be more than ________ characters​
    11·2 answers
  • (25 POINTS) Some applications work on all devices while others work on some devices. True or False?
    13·1 answer
  • Which software programs should students avoid using to create and submit course work? (Choose all that apply.
    15·1 answer
  • Resolution of bitmap graphics is typically measured in
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!