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 4
PAGE 1 / 4
Data Types
Home >>> Online Lessons, Python 3

Python is Dynamic!

One of the advantages of using the Python language is that any variable can dynamically hold values of different types throughout a program, without requiring type declaration as in initialization in C++.

The following code is already executed:
Editor - lesson_4.py
       
Console / Output done
What do we notice? Initially, the variable n held the integer value 123. Then it was assigned a string "Python", and finally a float value 23.25. After each assignment, we displayed the current value of the variable n.

Even the colors in the Python editor change because the data types differ ... 🧐

Additionally, we encountered our first issue when we tried to add two numbers entered from the keyboard. By default, the input function takes the input and returns it as a string for manipulation in our code - 2 + 3 doesn't equal 23!

It's time to study these data types!
Proceed to the next page of the lesson.
 home   list  CONTENTS   perm_identity   arrow_upward