You are on page 1of 2

Experiment No.

TITTLE: - Write a python program to implement basic string operations and string
methods.
PREREQUISITE: Fundamentals of Programming, OOP Concepts.

HARDWARE CONFIGURATION / KIT:

Sr. No Hardware Configuration


1 Processor 1.5GHz or more
2 RAM 4Gb Minimum
3 HDD Minimum 30Gb free Space

SOFTWARE CONFIGURATION:
Sr. No. Software Configuration
1 Operating System Windows 7 or later
2 Python Python 3.8

THEORY:
Python string is a sequence of Unicode characters that is enclosed in quotation marks. In
this article, we will discuss the in-built function i.e. the functions provided by Python to
operate on strings.

Case Changing of Strings


The below functions are used to change the case of the strings.
 lower(): Converts all uppercase characters in a string into lowercase
 upper(): Converts all lowercase characters in a string into uppercase
 title(): Convert string to title case
 swapcase(): Swap the cases of all characters in a string
 capitalize(): Convert the first character of a string to uppercase
Table of Python String Methods
Function
Name Description

Converts the first character of the string to a capital (uppercase)


capitalize()
letter

center() Pad the string with the specified character.

count() Returns the number of occurrences of a substring in the string.

endswith() Returns “True” if a string ends with the given suffix

find() Returns the lowest index of the substring if it is found

Returns the position of the first occurrence of a substring in a


index()
string

Checks whether all the characters in a given string is


isalnum()
alphanumeric or not

isalpha() Returns “True” if all characters in the string are alphabets

isdecimal() Returns true if all characters in a string are decimal

isdigit() Returns “True” if all characters in the string are digits

upper() Converts all lowercase characters in a string into uppercase

You might also like