Python ProgrammingPython Programming

Randomly capitalize letters in string in Python

from random import choice

x = "canada japan australia"
print(''.join(choice((str.upper, str.lower))(c) for c in x))

Output
CANaDA JaPan auStRALIa