An introduction to text values

To control texts with Python, as a developer, I need to use Strings


Introduction

A variable can store different types of data, such as text.

Example:

a = "hello"
print( a )
print( type(a) )

a is a variable with the value hello

print( a ) will show the hello in the terminal

type (a) shows what type a variable is (a string in this case)


The output will then be:

hello
<class 'str'>

where '<class str>' means 'string' (a string of characters) which is a 'text'


Instructions

Important: use "hello" and not "Hello", since there is a difference between capital H and a small h!


-

Python code



Terminal output


Written by: Bartek / Bartlomiej Rohard Warszawski

?>