print("Hello World"[1]) # Output: e
The float function is used to convert a string to a float value.
first = float(input("Enter the first number: "))
We can also change this expression to first + second, which is another way to write
this piece of code.
The lower method is used to convert a string to lowercase or to find a character or
a sequence of characters.
string = "Hello World"print(string.lower()) # Output: hello
worldprint(string.find('o')) # Output: 4print(string.replace('o','a')) # Output:
Hella Warld
The in operator can be used to check if a string contains a character.
string = "Python is a programming language for beginners."print('language' in
string) # Output: True
Arithmetic Operators in Python
Python has various arithmetic operators that we can use, such as addition (+),
subtraction (-), multiplication (*), and division (/).
The float function is used to convert a string to a float value.
first = float(input("Enter the first number: "))
We can also change this expression to first + second, which is another way to write
this piece of code.
The lower method is used to convert a string to lowercase or to find a character or
a sequence of characters.
string = "Hello World"print(string.lower()) # Output: hello
worldprint(string.find('o')) # Output: 4print(string.replace('o','a')) # Output:
Hella Warld
The in operator can be used to check if a string contains a character.
string = "Python is a programming language for beginners."print('language' in
string) # Output: True
Arithmetic Operators in Python
Python has various arithmetic operators that we can use, such as addition (+),
subtraction (-), multiplication (*), and division (/).