Page 1 of 1

Python: Declaring Datatypes

Posted: Tue Feb 10, 2026 4:19 pm
by Jason
Declaring Datatypes - # 2 (2nd Method)

Code: Select all

 # declaring-datatypes.py
 
 # Declaring datatypes  is optional in Python.  If you want to declare them for clarity, maybe, then below is how.
 
the_age_of_the_person = int(22)

the_GPA_of_the_person = float(3.7)

the_name_of_the_person = str("Joanne")

is_the_person_elderly = bool(False)

# Note the same can be accomplished without declaring the datatype as is usually the case in Python:

the_age_of_the_person = 22

the_GPA_of_the_person = 3.7

the_name_of_the_person = Joanne