Data types
The following table
provides an overview of the most frequently used data types in
Python.
Variable type Example Usage
comment
You can store data of all
types inside a variable using the assignment operator “=”.
Multiline strings can be used to store large
text blocks.
long_text = “””
Line one
Line
two
Line
three
Line
Four
“””
As you can see, a
multiline string is a normal string enclosed by triple quotes instead of
single ones.
In Python it is possible to
convert strings to integers and integers to strings:
>>> str(100)
‘100’
>>> int(“234”)
234
Quiz
PROBLEM:
1. What is the name of
this = operator?
2. How to convert a digit
3.14 into a string ‘3.14’?
ANSWER:
1. assignment operator
2. str(3.14)
Next:-Basic math/string operation
To be continued Enjoy
with python:)
Comments
Post a Comment