The name “Delton” is the expected output. But the given input is “delton” .Use appropriate string handling mechanisms to get the expectedoutput.
Question
The name "Delton" is the expected output. But the given input is "delton" .Use appropriate string handling mechanisms to get the expected output.
Solution
Sure, here is how you can convert the first letter of the string to uppercase to get the expected output:
- First, you need to take the input string "delton".
- Then, you need to use the string method called
capitalize()
. This method returns a copy of the original string and converts the first character of the string to a capital (uppercase) letter, while making all other characters in the string lowercase letters. - Here is how you can do it:
# Given string
s = "delton"
# Convert first letter to uppercase
s = s.capitalize()
# Print the result
print(s)
When you run this code, it will print: Delton
. This is your expected output.
Similar Questions
Find output of the below program:int main(){ char str[]={'e','a','r','t','h'}; printf("%s", str); return 0;}
10.What will be the output of the following Python code?string = "my name is x"for i in string.split(): print (i, end=", ")
Identify the built-in function used for reading a string from the keyboard.printreadinputintstr
What will be the output of the following code?Name = ‘saif’print(type(Name))Options: Pick one correct answer from belowintstrcomplexNone of the above
Read a string with words separated by space and return its length and count of consonants.Sample Inputwrite a programSample Output158
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.