Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define a function called myfunc that takes in a string, and returns a matching string where every even letter is uppercase, and every odd letter

Define a function called myfunc that takes in a string, and returns a matching string where every even letter is uppercase, and every odd letter is lowercase. Assume that the incoming string only contains letters, and don't worry about numbers, spaces or punctuation. The output string can start with either an uppercase or lowercase letter, so long as letters alternate throughout the string Remember, don't run the function, simply provide the definition To give an idea what the function would look like when tested:

myfuncC'Anthropomorphi sm) #Output: 'aNtHrOpOm0rPhIsM | Added note: this exercise requires that the function return a string. Print statements will not work here. A Oops, your solution is incorrect 1- def myfunc(string): 2 lst = [] 3 for i in range (0,len(string)): exercise.py False is not true: This is incorrect if ix2-0: 1 lst.appendCstringi]) else: Lst.append(string[i].upper a -join(lst) return(a)

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

Design Operation And Evaluation Of Mobile Communications

Authors: Gavriel Salvendy ,June Wei

1st Edition

3030770249, 978-3030770242

More Books

Students also viewed these Programming questions

Question

Describe ERP and how it can create efficiency within a business

Answered: 1 week ago