Python Tutorial
About Lesson

In this Python String lesson we want to learn about Create Strings Data Type in Python, because most programs gather some sort of data, and after that they do something useful with that. now first of all what is string ? so string is a series of characters. Anything inside quotes is considered a string in Python.

 

These are python string, you can create strings in single and double quotes.

 

Also we can use variables with Strings.

 

 

You can use functions with strings, for example we are going to make upper and lower the string.

 

 

This is the result.

Python String - Create Strings Data Type in Python
Python String – Create Strings Data Type in Python

 

 

Also you can use f-string, so F-strings provide a way to embed expressions inside string literals, using a minimal syntax.

 

 

 

 F-String was introduced in python 3.6, if you are using python 3.5 than you can use .format.

 

 

 

You can add newline and tab in the string 

 

 

 

This is the result.

Python String Data Type
Python String Data Type

 

 

 

Also you can concatenate two strings, for example you have two strings and you want to make it one string than you can simply add these two strings.

 

 

 

Also you can do slicing on python strings, for example in here i want to get the characters from 2 up to 4.

 

Thank you for visiting my website! If you enjoyed the free courses, please consider supporting my works on Patreon.
Exercise Files
No Attachment Found
No Attachment Found