Your First Program

Your First Program#

Data Types#

How a programming language recognizes or understands the type of information shapes how it executes specific commands or operations.

Commonly-used data types (with Python examples) include:

NamePython SyntaxExampleDescription
Stringstr()"Hello World!"String of characters
Integerint()7Whole number
Floatfloat()1.5Decimal number, or number with floating point values
Booleanbool()TrueTwo-state system that typically represents true/false values
Nothing/Null/NoneTypeNoneTypeNoneNo value

We can use the type() function in Python to check an object or value’s data type.

  • type is the function name

  • The value or information we are passing to the function goes inside the parenthesis

# a type example
type("Hello world!")

Comprehension Check#

Clipboard icon Data Types Comprehension Check

Comments#

Comments mark instructions or information in the code that will not run as part of the program. Comments are useful for testing, documenting, and describing what your code is doing.

In Python, single line comments begin with a pound # symbol and multi-line comments are marked by three sets of double quotation marks """.

# This is an example of a single line comment in Python

"""
This is an example of a multi-line comment in Python
"""