You should be familiar with the concept of reversing a string. In this task, you will write a different variation where not all characters are reversed. In particular, you will write a function reverse_lower (s:str) -> str that only reverses lowercase letters and leave other characters where they are. For example, reverse_lower('aBcD45ef') ==> 'fBeD45ca' In the example above, we only reverse acef which gives feca, but then in the return string you need to make sure that other characters remain at the same location. Therefore, the return string is fBeD45ca. Note how we leave _B_D45 unchanged. reverse_lower('abc') == 'cba' reverse_lower('ABC') == 'ABC' reverse_lower('A123bc') == 'A123cb' reverse_lower('muic-2021') == 'cium-2021' reverse_lower('M-ahid--ol') 'M-lodi--ha'
You should be familiar with the concept of reversing a string. In this task, you will write a different variation where not all characters are reversed. In particular, you will write a function reverse_lower (s:str) -> str that only reverses lowercase letters and leave other characters where they are. For example, reverse_lower('aBcD45ef') ==> 'fBeD45ca' In the example above, we only reverse acef which gives feca, but then in the return string you need to make sure that other characters remain at the same location. Therefore, the return string is fBeD45ca. Note how we leave _B_D45 unchanged. reverse_lower('abc') == 'cba' reverse_lower('ABC') == 'ABC' reverse_lower('A123bc') == 'A123cb' reverse_lower('muic-2021') == 'cium-2021' reverse_lower('M-ahid--ol') 'M-lodi--ha'
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
assert (reverse_lower('abc') == 'cba')
assert (reverse_lower('ABC') == 'ABC')
assert (reverse_lower('A123bc') == 'A123cb')
assert (reverse_lower('muic-2021') == 'cium-2021')
assert (reverse_lower('M-ahid--ol') == 'M-lodi--ha')
assert (reverse_lower('XJjHVzheiy') == 'XJyHViehzj')
assert (reverse_lower('L5bIgto2gv6W') == 'L5vIgot2gb6W')
assert (reverse_lower('sYmA5Poekfz0k9') == 'kYzA5Pfkeom0s9')
assert (reverse_lower('hDuAt5zqBSFg6-F3') == 'gDqAz5tuBSFh6-F3')
assert (reverse_lower('MreN13pdEbI28D1J3N') == 'MbdN13peErI28D1J3N')
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education