PYthon Class 15 Telugu
PYthon Class 15 Telugu
~~~~~~~~~~~~~~~~~~~~
Default Values
~~~~~~~~~~~~~~~~~~~~~~
begining|starting value = 0
Ending = Length of the string
Step|changing value = +1
eg:
s='abcdefghij'
1. + --> Concatenation
2. * --> Repetition
+(String Concatenation)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
eg:
# Program to display your Name and Course
nm=input("Enter Your Name: ")
co=input("Enter Your Course Name: ")
print("Name ="+nm)
print("Course ="+co)
eg:
# Program to display your Name and Course
nm=input("Enter Your Name: ")
age=int(input("Enter Your Age: "))
print("Name ="+nm)
print("Age ="+str(age))
eg:
for i in s[::]:
print(i,end='')
eg:
for i in s[::-1]:
print(i,end='')
* (Repetition)
~~~~~~~~~~~~~~~~~~~~
It is used to display the string multiple number of times based on the users'
requirement
eg:
Checking Membership
~~~~~~~~~~~~~~~~~~~~~~~~
1. in
2. not in
s="where there is a will there is a way"
print('is' in s)
print('are' not in s)
print('is' not in s)
print('are' in s)
String Comparison
~~~~~~~~~~~~~~~~~~~~~
eg:
Note:
~~~~~~~~~
1. upper()
~~~~~~~~~~~~~
Syntax:
-----------
str.upper()
eg:
eg:
print("\n"*5)
2. lower()
-----------------
Syntax:
~~~~~~~~~~~~~~
str.lower()
eg: