FREE INTERACTIVE ONLINE COURSE

Python 3

FOR BEGINNERS


"The first Python course that simply amazed me. Very well explained and easy to understand." (Alexandru Cosmin)

"The best Python course in Romania." (Iulian Geană)


ALL REVIEWS
LESSON 8
PAGE 1 / 5
Strings
Home >>> Free Online Lessons, Python 3

Introduction

We have used strings before. They are assigned simply by writing the text between single quotes, double quotes, or a combination of three of each to write a text on multiple lines.

EXAMPLE
Editor - lesson_8_strings.py
       
Console/Output done
DETAILS

The data type is str, meaning a string of characters (in a simple form, a string).

Python has the ability to adapt, so assignments without explicitly imposing the type automatically lead to the creation of str objects.

We also know that the input() function reads a string of characters entered by the user from the keyboard and returns it as a str type. The read data must eventually be explicitly converted to a data type for processing, otherwise, we may encounter interpretation errors:



Good. Let's see what more we can do!

Note. In other programming languages, there is the char type, which holds a single character - Python does not offer this because it is considered that we can define a string of characters with a length of 1simple.
Run the program then proceed to the next page.
 home   list  CONTENTS   perm_identity   arrow_upward