27 lines
921 B
Python
27 lines
921 B
Python
# This will show some very basic Python operations and actions
|
|
|
|
# We show output in the terminal to a user with the "print" function
|
|
print("Hello world!")
|
|
|
|
# This is a variable. A variable holds information like a string (letters and such),
|
|
# integers (whole numbers), arrays and objects (discussed later)
|
|
# Our first "string"
|
|
name = "Computer User"
|
|
# We can print many things in one print command on one line by
|
|
# separating them with commas
|
|
print("Your name is:", name)
|
|
|
|
# Our first number
|
|
# The "=" here is an "assignment operator"
|
|
# meaning "assign the value on the right to the variable on the left"
|
|
# (i.e. assign age equal to 32)
|
|
age = 32
|
|
print("Your age is:", age)
|
|
|
|
# Basic math:
|
|
# Python includes math operators for addition, subtraction,
|
|
# multiplication and division (and many others).
|
|
age = age + 1
|
|
# Age is now equal to 33
|
|
# Someone had a birthday!
|
|
print("Happy Birthday! You are now", age, "years old!") |