Write a python program to convert all the letters in the string to uppercasestring = "Hello World"print(string.upper())string = "Hello World"print(string.title())string = "Hello World"print(string.capitalize())string = "Hello World"print(string.Upper())
Question
Write a python program to convert all the letters in the string to uppercasestring = "Hello World"print(string.upper())string = "Hello World"print(string.title())string = "Hello World"print(string.capitalize())string = "Hello World"print(string.Upper())
Solution
Sure, here is the corrected Python code:
string = "Hello World"
print(string.upper()) # Converts all the letters in the string to uppercase
string = "Hello World"
print(string.title()) # Converts the first character of each word to uppercase and the rest to lowercase
string = "Hello World"
print(string.capitalize()) # Converts the first character of the string to uppercase and the rest to lowercase
Note: Python does not have a string.Upper() method. The correct method to use is string.upper().
Similar Questions
Write a program that converts strings of all uppercase characters into strings of all lowercase and viceversa
How can you convert a lowercase character to uppercase manually in a string?
What is the correct way to convert a string to uppercase in Java?Question 1Answera.toUpper()b.toUpperCase()c.uppercase()d.convertToUpperCase()
Write a method that takes a String and returns it in AltCase.This means that the first letter is uppercase and each subsequent character alternates between lowercase and uppercase.Here are some examples of words in AltCase:HeLlOHeLlO WoRlDThIs iS In aLtCaSe.Note: if there is a space, you still treat that as a character, so the String "A B" is in AltCase, since technically, the space between the letters is lower case.
Which method can be used to return a string in upper case letters?
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.