изменить регистр in python

To change the case of a string in Python, you can use the upper() and lower() methods. Here's the code:

main.py
# Convert to uppercase
string_example = "Hello, World!"
uppercase_string = string_example.upper()
print(uppercase_string)  # Output: HELLO, WORLD!

# Convert to lowercase
string_example = "Hello, World!"
lowercase_string = string_example.lower()
print(lowercase_string)  # Output: hello, world!
295 chars
10 lines

The upper() method converts the string to uppercase, while the lower() method converts it to lowercase.

gistlibby LogSnag