Answer to Question #281101 in Python for Rahul Sigh

Question #281101

String processing


Full Question in the image


You are given a dictionary that maps all lowercase English alphabets from

'a' to 'z' to either lor -1.


For a string of length k, you perform the below operation:

•      Find the maximum character from index Ito k, and find the dictionary mapping of the respective maximum character.

•      If dictionary mapping is 1, increment all characters from Ito k.

•      'a' becomes 'b', 'b' becomes 'c', .      'z' becomes 'a'.



Task

Determine the count of each lowercase English alphabet after N operations.


Please read Full Instructions and Note Please Use Those Images as reference... Please help


https://drive.google.com/file/d/1QVE-utPuKxxxah3P5T5geL93MX1G5vy_/view?usp=sharing

https://drive.google.com/file/d/1b3RT2IBIBMG2Ojob6uGqoDglXHg-Z928/view?usp=sharing
1
Expert's answer
2021-12-20T10:04:03-0500
import string
as_l = string.ascii_lowercase


mapping = dict(zip(as_l, as_l[::-1]))


str_input = str(input("Enter the letters: "))
str_output = ''.join(mapping[c] for c in str_input) # assume every c in my_map


print("The inverse mode is:",str_output) # zyxw

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS