Strings in Python
STRINGS.
String is a data-type in python. String is created by enclosing text in quotes. You can use either Single quotes (' ') or Double quotes (" ").
Examples:
name="Hello "
address="This is a string"
sttring='This is single quotes string'
* Input a String:
string_var_name=input("Enter a string")
* Length of String:
To find a length of string we use (Len) Function.
For Example :
print(len("Hello"))
>> Output >> 5 >>
Some useful String Functions:
- strcat (String Concatenation)
- strcpy (String copy)
- srtcom (String Comparison)
- strlen (String Length)
- strrev (String Reverse)
In next page we briefly learn about string functions..
name="Hello "
address="This is a string"
sttring='This is single quotes string'
* Input a String:
string_var_name=input("Enter a string")
* Length of String:
To find a length of string we use (Len) Function.
For Example :
print(len("Hello"))
>> Output >> 5 >>
Some useful String Functions:
- strcat (String Concatenation)
- strcpy (String copy)
- srtcom (String Comparison)
- strlen (String Length)
- strrev (String Reverse)
Comments
Post a Comment