You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
293 B
Python

def to_uppercase(str1):
num_upper = 0
for letter in str1[:4]:
if letter.upper() == letter:
num_upper += 1
if num_upper >= 2:
return str1.upper()
return str1
print(to_uppercase('Python'))
print(to_uppercase('PyThon'))