(Solved) : Wrote Function First Applied Circaesarvowelstr String Shift Def Circaesarvowel Char Shift Q42677341 . . .

If we wrote a function which first appliedcirCaesarVowel_Str(String,Shift)

”’def cirCaesarVowel(Char, Shift):
lower_vowels = “aeiou”
upper_vowels = “AEIOU”
if Char in lower_vowels:
pos = (lower_vowels.find(Char)+Shift)%5
return lower_vowels[pos]
elif Char in upper_vowels:
pos = (upper_vowels.find(Char)+Shift)%5
return upper_vowels[pos]
return Char

def cirCaesarVowel_Str(String, Shift):
result = “”
for ch in String:
result += cirCaesarVowel(ch, Shift)
return result”’

and then applied caesar_str(String,Shift):

from string import ascii_lowercase as lc
from string import ascii_uppercase as uc

def caesar(Ltr,shift):
”’Returns shifted ltr, rolling to beginning of alphabet
if necessary. Only encodes lc or uc letters.”’
if Ltr in lc:
ndx = lc.find(Ltr)
shifted_ndx = (ndx + shift) % 26
return lc[shifted_ndx]
elif Ltr in uc:
ndx = uc.find(Ltr)
shifted_ndx = (ndx + shift) % 26
return uc[shifted_ndx]
return Ltr

def caesar_Str(Str,shift):

”’Returns a string, Str, encoding only the letters.”’
cypher = ”
for Ltr in Str:
cypher += caesar(Ltr,shift)
return cypher

The question is: Will the new function produce the same outputfor any String and any Shift?

Expert Answer

Answer to If we wrote a function which first applied cirCaesarVowel_Str(String,Shift) ”’def cirCaesarVowel(Char, Shift): lower_vo…

Leave a Comment


We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?