Python string handling with example
In this tutorial , we will discuss the python string handling with example.
A string is a set of characters inorder. E.g. a letter, number and symbol may become a character.
We can print a string many way using single quote , double quote and triple quote in python.
1. print(‘hello’) //print using with single quote
2. print(“hello”) // print using with double quotes
3. print(”’hello”’) //print using with triple- single quotes
4. print(“””hello”””) // print using with triple – double quotes
Output here
We can print a string using single quote with variable.
5. first_string=’hello’ // assign a string to variable using single quote
print(first_string) // print string with variable
We can print a string using double quote with variable.
6. second_string=”hello” // assign a string to variable using double quote
print(second_string) // print string with variable
We can print a string using triple – single quote with variable
7. third_string=”’hello”’ // assing a string to variable using triple – single quote
print(third_string) // print string with variable
We can print a string using triple – double quote with variable
8. forth_string=”””hello””” // assing a string to variable using triple – double quote
print(forth_string) // print string with variable
Table of Contents
multiple_line_string=”’hello
how
are
you”’ // assing a string to variable using triple – single quote
print(multiple_line_string) // print string with variable
2. using triple – single quote to print multiple line string
multiple_line_string=”””hello
how
are
you””” // assing a string to variable using triple – single quote
print(multiple_line_string) // print string with variable
Multiply two numbers in Java using scanner| 5 different ways In this article, we will…
5 Different ways to Divide two numbers in Java using scanner In this article, we…
Learn 8 Ways to Subtract Two Numbers Using Methods in Java In this article, we…
10 ways to subtract two numbers in Java In this article, we will discuss the…
Java Code Examples – Multiply Two Numbers in 5 Easy Ways In this article, we…
How to Divide two numbers in Java| 5 different ways In this article, we will…
This website uses cookies.