Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python , IN A HURRY!! Question 3 ( 32 points ) : The list my_list is doubled value if each element appears exactly twice in

image text in transcribed

Python , IN A HURRY!!

Question 3 ( 32 points ) : The list my_list is doubled value if each element appears exactly twice in 2 successive places in the list (one after the other). example: 10 10 30 30 -5 -5 12 12 17 17 -2 -2 15 15 Sometimes it can occur that one of the elements (only one element) appears only once and not 2 times as required. Write a function def f3 (my list) my_list is such a list that almost doubled value except 1 element that appears only 1 time. The function finds the value of this element and its position and returns both as a result, according to the following example : b = [10,10,30,30,9,-5,-5,12,12,17,17] val, pos=f3 (b) print (val, pos) we get 94 Because the value that appears only 1 time is 9 and it is located in index 4 in the list. Requirement : The function should be efficient in time and place

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Power Bi And Azure Integrating Cloud Analytics For Scalable Solutions

Authors: Kiet Huynh

1st Edition

B0CMHKB85L, 979-8868959943

More Books

Students also viewed these Databases questions