Page 118 - TrackpadV5.1_class8
P. 118
upper(): The upper() function converts all lowercase letters to uppercase. Syntax of using
upper() function is:
string_name.upper()
capitalize(): The capitalize() function returns a string with the first character in capital. Syntax
of using capitalize() function is:
string_name.capitalize()
Program 10: To use various string built-in functions
Program10.py
File Edit Format Run Options Window Help
str = 'Hello'
print(len(str))
print('Hello'.lower())
print('hello'.upper())
print('hello'.capitalize())
Output
5
hello
HELLO
Hello
1. What is a string?
______________________________________________________________
uiz Bee 2. What are escape sequences?
______________________________________________________________
LIST
In Python, a list is a type of container that is used to store a list of values of any type. One can
store an integer, string as well as objects in a single list. Each element in a list is assigned an index
number. The first index is 0, the second index is 1, the third is 2, and so on.
CREATING A LIST
Lists can be created by inserting the elements in square brackets []. The elements in the list are
separated by a comma.
116 Pro (V5.1)-VIII

