Python: Declaring Datatypes

Post Reply
User avatar
Jason
Site Admin
Posts: 642
Joined: Sun Dec 21, 2025 8:56 pm

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

 

POSTREACT(ions) SUMMARY

Post Reply