Give examples that show different features of string slices


Python Problem

Part I

For each function, describe what it actually does when called with a string argument. If it does not correctly check for lowercase letters, give an example argument that produces incorrect results, and describe why the result is incorrect.

A)

def any_lowercase1(s):
for c in s:
if c.islower():
return True
else:
return False

B)

def any_lowercase2(s):
for c in s:
if 'c'.islower():
return 'True'
else:
return 'False'

C)

def any_lowercase3(s):
for c in s:
flag = c.islower()
return flag

D)

def any_lowercase4(s):
flag = False
for c in s:
flag = flag or c.islower()
return flag

E)

def any_lowercase5(s):
for c in s:
if not c.islower():
return False
return True

Part II

Give at least three examples that show different features of string slices. Describe the feature illustrated by each example.

The response must include a reference list. Using Times New Roman 12 pnt font, double-space, one-inch margins, and APA style of writing and citations.

Request for Solution File

Ask an Expert for Answer!!
Python Programming: Give examples that show different features of string slices
Reference No:- TGS03112090

Expected delivery within 24 Hours