Python: Declaring Datatypes

Post Reply
User avatar
The Jason
Site Admin
Posts: 888
Joined: Tue Jul 01, 2025 10:13 am
Contact:

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

 

POSTREACT(ions) SUMMARY

Post Reply