Strings in Python
Strings in Python
str2="black"
print("Is both Equal:",
str1==str2) print("Is str1> str2:",
str1>str2) print("Is
OUTPUT: str1< str2:",
str1<str2) Is both Equal: False
Is str1> str2: True
Is str1< str2: False
Problem Solving and Python Programming 13
String formatting
operator
• String formatting operator % is unique
to strings.
• Example:
print("My name is %s and i secured %d
marks in python” % ("Arnab",92))
• Output:
My name is Arnab and i secured 92 marks
in python
Problem Solving and Python Programming 14
String functions and
methods
len() min() max() isalnum() isalpha()
rstrip() strip()
Output:
Output: