Page 1 of 1

Python: Declaring Datatypes

Posted: Tue Nov 04, 2025 12:06 pm
by The Jason

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(5)

the_GPA_of_the_person = float(3.8)

the_name_of_the_person = str("Mary")

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

the_age_of_the_person = 5

the_GPA_of_the_person = 3.8

the_name_of_the_person = Mary