A string value containing more than 1 word is passed as the input(runtime) to the program(hint-use swapcase by splitting-string) | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 2

A string value containing more than 1 word is passed as the input(runtime) to the program(hint-use swapcase by splitting-string)

input: tHiS is my book required output: ThIs is my book

2nd Sep 2018, 5:38 AM
THARUN KUMAR M
THARUN KUMAR M - avatar
2 Antworten
+ 7
also: s = input().split() print(*(w.swapcase() if w == s[0] else w for w in s))
2nd Sep 2018, 6:32 AM
David Ashton
David Ashton - avatar
+ 16
def solve(s): s = s.split(' ', 1) return s[0].swapcase() + ' ' + s[1]
2nd Sep 2018, 5:57 AM
Eduardo Petry
Eduardo Petry - avatar