Need Assistance?

support@tutorialshub.in

Python Fundamentals

Installing Python

ADVERTISEMENT
Python Free Lesson
5 min read
ADVERTISEMENT

Variables are names bound to objects

Python variables do not work like fixed typed boxes. Assignment binds a name to an object. The object has a type and value, and the same name can later be rebound to another object.

Important built-in types

Integers represent whole numbers, floats represent floating-point numbers, booleans represent truth values, strings represent text, lists store mutable sequences, tuples store immutable sequences, sets store unique values and dictionaries map keys to values.

Mutable and immutable data

Understanding mutability becomes important when several names refer to the same object. Changing a list can affect every reference to that list, while changing an integer or string creates a new value rather than modifying the existing object.

Practice: create a customer record containing an ID, name, balance, active flag and list of skills. Print the value and type of each field, then update the balance and add a skill.

ADVERTISEMENT