Suppose you have a sentineled, doubly-linked list class as specified in project 2 and an object of that class called my_list. The function below finds and returns the first index of a specified value in that list, but portions have been removed. Using the minimum possible spacing at all in your answers, fill in the missing code. This algorithm does not employ the __iter__ and __next__ methods of the Linked_List class. Also note that this exercise does not include the object names, so your answers should include my_list. as appropriate. Finally, none of your responses should contain colons. As a reminder, the linked list implementation provides the following methods: insert_element_at(value, index) #cannot be used to append
append_element(value)
get_element_at(index)
remove_element_at(index)
__len__ #support for the len method to obtain the list's size
def index_of(my_list, val):
for k in :
if :
raise ValueError
and what is the performance?

Answers

Answer 1

Answer:

def index_of (my_list, val):

  for k in range(my_list.__len__):

      if my_list.get_element_at(k) == val :  

          return k

Explanation:

The python function "index_of" accepts two arguments, a list and the value to be searched for.

The for-loop iterates over the list using the "__len__" magic method to return the index of the searched term in the list if present.


Related Questions

Which is a potential disadvantage of emerging technologies? A. increased spread of misinformation due to advanced communication technologies B. inefficient usage of energy due to advanced manufacturing technologies C. only benefiting developed countries rather than developing ones D. slowing down global economic growth

Answers

Answer: I believe it’s D.

Explanation: Less developed countries may not be able to afford the new technology, while more developed ones will be able to do so. Meaning the less developed countries will most likely not change.

Which steps will import data from an Excel workbook? Use the drop-down menus to complete them.
1. Open the database.
2. Click the *BLANK*
tab.
3. In the import & Link group, click *BLANK*
4. Click *BLANK* to locate a file.
5. Navigate to and open the file to import.
6. Select the Import option.
7. Click OK.
8. Follow the instructions in the wizard to import the object.

Answers

Answer:

what are the blank options

Answer:

The answer is

1. External Data

2. Excel

3. Browse

Explanation:

EDGE 2021

Jobs with only 7 letters

Answers

Answer:

nursing

Explanation:

it's needs 20 words so don't mind thisssss part hehe

Answer: Teacher!!!!!!

A gui allows you to interact with objects on the screen such as icons and buttons true or false

Answers

Answer:

True

Explanation:

Rupesh wants to try programming with Eclipse. What is the first step he should take to make that happen?


download the Eclipse IDE

download the current Java Development Kit

create a restore point

disable his security program

Answers

Answer:

create a restore point

Explanation:

Write a program in file MinMax.py that accepts an arbitrary number of integer inputs from the user and prints out the minimum and maximum of the numbers entered. The user will end the input loop by typing in the string 'stop'. When the user enters 'stop' your program should print out the minimum integer entered and the maximum integer entered. If the user enters 'stop' immediately (i.e., before any numbers are entered), you'll print a slightly different message. See the examples below: You can assume that the values entered are integers (positive, negative or zero) or the string 'stop' (lowercase). You don't have to validate the inputs. > python Min Max. py
Enter an integer or 'stop' to end: stop You didn't enter any numbers > python Min Max. py
Enter an integer or 'stop' to end: -10
Enter an integer or 'stop' to end: 0 Enter an integer or 'stop' to end: +42
Enter an integer or 'stop' to end: 87 Enter an integer or 'stop' to end: -100
Enter an integer or 'stop' to end: stop The maximum is 87 The minimum is -100

Answers

Answer:

The program is as follows:

numlist = []

num = input("'stop' to end: ")

while not (num == "stop"):

   numlist.append(int(num))

   num = input("'stop' to end: ")

   

if len(numlist) == 0:

   print("You didn't enter any numbers")

else:

   print("The maximum is "+str(max(numlist))+" and The minimum is "+str(min(numlist)))

Explanation:

This declares an empty list

numlist = []

This prompts the user for input

num = input("'stop' to end: ")

This loop is repeated until the user enters 'stop'

while not (num == "stop"):

This appends the input to the list

   numlist .append(int(num))

This prompts the user for input

   num = input("'stop' to end: ")

   

If the length of the list is 0, then the user entered no input

if len(numlist) == 0:

   print("You didn't enter any numbers")

If otherwise, this prints the min and the max

else:

   print("The maximum is "+str(max(numlist))+" and The minimum is "+str(min(numlist)))

The program that accepts an arbitrary number of integer inputs from the user and prints out the minimum and maximum of the numbers entered is as follows:

numbers = []

x = input("Enter an integer and stop to end: ")

while not(x == "stop"):

    numbers.append(int(x))

    x = input("Enter an integer and stop to end: ")

if len(numbers) == 0:

    print("You didn't enter any numbers ")

else:

    print(f"The maximum number is {max(numbers)} and the minimum number is {min(numbers)}")

Code explanation:

The code is written in python

The first line of code, we declared a variable named numbers and it is an empty list for storing our integers.The variable x is stores the user inputwhile the user's input is not lowercase "stop", the user's input is appended to numbers. Then the program ask for the users input as long as it is an integers inputif the length of the list is 0, then we print a statement to ask the user to enter a number.Else we print the maximum and minimum number of the user's input.

learn more on python code here: https://brainly.com/question/19175881

What is the most likely reason a user would export data with the formatting in place?

A) The fields will not have any errors.

B) The file will be much easier to read.

C) The file is automatically spellchecked.

D) The columns are automatically alphabetized.

Answers

Answer:

its d

Explanation:

Answer:

its b on edge

Explanation:

believe me if youre a viber

what is memory address map​

Answers

the mapping between loaded executable or library files and memory regions, these are used for resolving memory addresses

What are some common uses of Excel?

Answers

Answer:

to make a spread sheet and to make sure you have all of the sum and didn[t miss a number

Explanation:

a worldwide system of computer network​

Answers

Answer:

The internet is a worldwide system of computer network.

Fill in the blank with the correct response.
Your Java class should be given the same name as your Java
.

Answers

Answer:

program

Explanation:

PLEASE SOMEONE ANSWER THIS
If the old code to a passcode was 1147, and someone changed it, what would the new code be?

(I already tried 4117)



[I forgot my screen time passcode please someone help I literally can’t do anything on my phone.]

Answers

Answer:

Any of these?

Explanation:

1147. 4117. 7411

1471. 4171

1714. 4711

1741. 7114

1417. 7141

Answer:

1417

Explanation:

Write a function charInWord that takes in two parameters, a char (character) and a word (string). The program will return true if the character is in the word and false if it is not. If word is not a string type, or if char is not a string type, or if the length of char is greater than 1, the function should return None. Your main program should call the function and print char is in word if the function returns true, or char is not in word if the function returns false, using the user-supplied values instead of char and word. The program should print incorrect input provided if the function returns None. Ex: If the input is: a cat the output is: a is in cat Ex: If the input is: a club the output is: a is not in club Ex: If the input is: ab horse the output is:

Answers

Answer:

The program in Python, is as follows:

def charInWord(chr,word):

   if len(chr)>1:

       print("None")

   elif not(chr.isalpha() and word.isalpha()):

       print("None")

   else:

       if word.find(chr) == -1:

           print(chr+" is not in "+word)

       else:

           print(chr+" is in "+word)

chr = input("Character: ")

word = input("Word: ")

print(charInWord(chr,word))

Explanation:

This defines the function

def charInWord(chr,word):

This checks if the length of character is greater than 1

   if len(chr)>1:

If yes, it prints None

       print("None")

This checks if the character or the word contains invalid character

   elif not(chr.isalpha() and word.isalpha()):

If yes, it prints None

       print("None")

This is executed for valid parameters

   else:

If the character is not present, this is executed

       if word.find(chr) == -1:

           print(chr+" is not in "+word)

If the character is present, this is executed

       else:

           print(chr+" is in "+word)

The main begins here

This gets the character

chr = input("Character: ")

This gets the word

word = input("Word: ")

This calls the method and prints the required output

print(charInWord(chr,word))

Select the correct statement(s) regarding direct sequence spread spectrum (DSSS) and orthogonal frequency division multiplexing (OFDM).
a. OFDM is not classified as a spread spectrum technique, although OFDM has the effect of spreading the signal over a larger frequency spectrum
b. OFDM has greater spectral efficiency compared to DSSS
c. DSSS relies upon a PN code that is only shared by the transmitter and receiver pair
d. all statements are correct

Answers

Answer:

a. OFDM is not classified as a spread spectrum technique, although OFDM has the effect of spreading the signal over a larger frequency spectrum.

Explanation:

Orthogonal Frequency Division Multiplexing is a technique in which large digital data is sent over radio waves by splitting it into multiple subcarriers. The data is then transmitted to different users who can access the files. OFDM is not a spread spectrum technique, it is based on large frequency spectrum.

what is convergence ​

Answers

Answer:

the process or state of converging.

Explanation:

Answer:

the fact that two or more things, ideas, etc. become similar or come together.

Write a program that will read two floating point numbers (the first read into a variable called first and the second read into a variable called second) and then calls the function swap with the actual parameters first and second. The swap function having formal parameters number1 and number2 should swap the value of the two variables

Answers

Answer:

In Python:

def swap(number1,number2):

   a = number1

   number1 = number2

   number2 = a

   return number1, number2

   

first = float(input("First Number: "))

second = float(input("Second Number: "))

print("After Swap: "+str(swap(first,second)))

Explanation:

The swap function begins here

def swap(number1,number2):

This saves number1 into variable a

   a = number1

This saves number2 into number1

   number1 = number2

This saves a (i.e. the previous number1) to number2

   number2 = a

This returns the numbers (after swap)

   return number1, number2

   

The main begins here

The next two lines prompt the user for first and second numbers

first = float(input("First Number: "))

second = float(input("Second Number: "))

This calls the swap function and print their values after swap

print("After Swap: "+str(swap(first,second)))

Which of the following characterizes how an enabled security program might react to a new program installation on a computer system?


It might alert you to space requirement excesses.

It might report an error or tell you that the file is corrupted.

It might protect the new installation from getting viruses.

It might automatically set a restore point for the computer system.

Answers

Answer:

It might automatically set a restore point for the computer system

Answer:

It might report an error or tell you that the file is corrupted.

Explanation:

You are a visitor at a political convention with delegates; each delegate is a member of exactly one political party. It is impossible to tell which political party any delegate belongs to; in particular, you will be summarily ejected from the convention if you ask. However, you can determine whether any pair of delegates belong to the same party or not simply by introducing them to each other. Members of the same party always greet each other with smiles and friendly handshakes; members of different parties always greet each other with angry stares and insults.

Required:
Suppose more than half of the delegates belong to the same political party. Design a divide and conquer algorithm that identifies all member of this majority party and analyze the running time of your algorithm.

Answers

Answer:

The algorithm is as follows:

Step 1: Start

Step 2: Parties = [All delegates in the party]

Step 3: Lent = Count(Parties)

Step 4: Individual = 0

Step 5: Index = 1

Step 6: For I in Lent:

Step 6.1: If Parties[Individual] == Parties[I]:

Step 6.1.1: Index = Index + 1

Step 6.2: Else:

Step 6.2.1 If Index == 0:

Step 6.2.2: Individual = I

Step 6.2.3: Index = 1

Step 7: Else

Step 7.1: Index = Index - 1

Step 8: Print(Party[Individual])

Step 9: Stop

Explanation:

The algorithm begins here

Step 1: Start

This gets the political parties as a list

Step 2: Parties = [All delegates in the party]

This counts the number of delegates i.e. the length of the list

Step 3: Lent = Count(Parties)

This initializes the first individual you come in contact with, to delegate 0 [list index begins from 0]

Step 4: Individual = 0

The next person on the list is set to index 1

Step 5: Index = 1

This begins an iteration

Step 6: For I in Lent:

If Parties[Individual] greets, shakes or smile to Party[i]

Step 6.1: If Parties[Individual] == Parties[I]:

Then they belong to the same party. Increment count by 1

Step 6.1.1: Index = Index + 1

If otherwise

Step 6.2: Else:

This checks if the first person is still in check

Step 6.2.1 If Index == 0:

If yes, the iteration is shifted up

Step 6.2.2: Individual = I

Step 6.2.3: Index = 1

If the first person is not being checked

Step 7: Else

The index is reduced by 1

Step 7.1: Index = Index - 1

This prints the highest occurrence party

Step 8: Print(Party[Individual])

This ends the algorithm

Step 9: Stop

The algorithm, implemented in Python is added as an attachment

Because there is an iteration which performs repetitive operation, the algorithm running time is: O(n)

Define the Database ​

Answers

A structured base in a computer
Other Questions
Describe the two main factors that influence the path of surface currents.Enter your answer in the space provided. In an argumentative essay, where does the claim statement go? a at the end of the last paragraph b in the beginning of the second paragraph c in the beginning of the third paragraph d at the end of the first paragraph can someone please translate my english into spanish? EXPERT HELP I'LL GIVE BRAINLIEST: EXPLAIN THE ANSWER triva what is cave game????? 5 inArea6 in7 in10 in15 inHELP I NEED TO FIND AREA Every five years in August, the population of a certain city is recorded. In 2010, the city had a populationof 7500 people. From 2010 to 2015, the population decreased by 20%. From 2015 to 2020, thepopulation increased by 55%. What was the city's population in 2020? (3 points) Chen has $500 saved for a new TV. There is one on sale for $700. He can wait and save more money, or he can finance his purchase and make payments for two years. The payments add up to $850. Should he buy the TV on sale now? Calculate the formula weight or molecular for the following: a. LiCI b. SO2 (The 2 is in subscript) On this map, how is the international border between Northern Ireland and the Republic of Ireland represented? The diameter of a circle is 14 inches. What is the area? Give the exact answer in simplest form Synchronous presentations are recorded presentations so an audience can view it at a later dateTrue or false What is this number in expanded form?130,987100,000 + 30,000 + 900 + 80 + 7100,000 + 3,000 + 900 + 80 + 710,000 + 3,000 + 900 + 80 + 710,000 + 30,000 + 900 + 80 + 7 Ms. Rhodes gave 9 of the 36 students that are in her class a passing grade. Whichvalue is equivalent to the fraction of students that received a passing grade?A. .025B. 25%C. 9%D. .75 What is m CD ?Plzz help May I please have some help? 24. Explain what happens at the particle level when a solid melts. Again im sorry lol i need help Which number line shows the inequality n > -3?A-5 -4 -3 -2-1012 3 4 5604-5 -4 -3 -2 -++>3 4 5O12+++04-5 -4 -3 -2 -1 0 1HHH2 3 4 5-->1 2 3 4 5-5 -4 -3 -2 -1O 17.2(20+45)34(4.75)