Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

pls solve it 1. Complete the missing parts of the function unpdateList that updates a list of (5 points) integers as follows: - If the

pls solve it image text in transcribed
image text in transcribed
1. Complete the missing parts of the function unpdateList that updates a list of (5 points) integers as follows: - If the accessed integer is odd, then replace the integer by its cube. - If the accessed integer is even, then replace the integer by its square. Example: - Write a Python statements to define the list mylist shown in the above example, and update it using function updateList. 2. Complete the missing parts of function twoConsecutiveCharacters that (5 points) a) Receives one string S as parameter, and b) Returns two values: - The number of times two consecutive similar characters appear in the received string S. - A new string newS containing the consecutives characters with no repetition. Example: - Compates the occurrence of two consecutive similar characters is a striag define the paraneters of the funetion +4 parama the retarnsi Qe retarns 1 def twoConsecutiveCharactersi- (6+5 ptal Inderalire the occurreece counter occurrence = I Neor eapty Atring that eontaina the echecutive siallar ebaractera without repetitian for 1 in rangetlen(S)-1): tebeck if tho cossecutive characters are similar if occurrence +1 t check if the eharacter is already added te nevs it news-news+511 Consider the following function that is intended to swap the values of two integers. (5 points) - Why doesn't the falseSwap function swap the content of x and y ? (t pt)

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

More Books

Students also viewed these Databases questions