TECH1200 Week 1 Workshop
TECH1200 Week 1 Workshop
Fundamentals of
Programming
Lesson 1
Hello World!
COMMONWEALTH OF AUSTRALIA
Copyright Regulations 1969
WARNING
The material in this communication may be subject to copyright under the Act. Any
further reproduction or communication of this material by you may be the subject of
copyright protection under the Act.
Week 3 Lists
Week 4 Loops
Week 5 Functions
Week 7 Strings
Week 8 Modules
Week 9 Dictionaries
Week 10 Files
Week 11 Classes
Source: https://statisticstimes.com/tech/top-computer-languages.php
Python is friendly for beginners
• Python syntax is basic to understand, it’s an ideal language
for beginners, particularly with no or limited programming
experience
• Python is a general purpose language, and can be used in
various fields, such as but not limited to:
– Programming / Computer Science / Software Engineering
– Data Science
– Machine Learning
– Web Development
– Scripting Tools
– Applications and Analysis Tools
• Popular frameworks and libraries, like: TensorFlow, Numpy,
SciPy, Pandas, Theano, PyTorch, Keras, Matplotlib,
BeautifulSoup, OpenCV, and more than 100,000 others!
Python programming language
• Python, like other programming
languages, allows us to communicate
commands to a computer
• In this subject, we will use Python 3
• Our first program “Hello World!”
– Input commands
variable_name = "World"
print("Hello " + variable_name + "!")
Answer:
This is the value
Reason:
• The stored value in variable can be
changed after it has been set
Comments
• Comments start with a #
1. Comments can be at the start of a line
# Our first program to print "Hello World!"
variable_name = "World"
print("Hello " + variable_name + "!")
Answer:
• ZeroDivisionError – occurs when a
number (denominator) is divided by a 0 or
0.0 result = numerator / denominator
ZeroDivisionError: division by zero
Numbers
• There are three numeric types:
1. int
• Integer or int, must be a whole number, it can be 0,
positive or negative, but must be without decimals
2. float
• “Floating point number” or float, is a number, it can be
positive or negative, but must contain one or more
decimals
3. complex
• Complex numbers assign a “j” to the variable value as
the imaginary part. For this subject, you will not use
this numeric type
Activity
• For each of the variables, what type of
variable is it? a = 0
b = 42.1
c = -912
d = "678"
e = 13513517
f = 0.0
g = -13.012
# 6 squared, 6^2, or 36
print(6 ** 2)
# Prints 1
# Important Note for "Modulo % 2"
# Returns "0 for even numbers" and "1 for odd numbers"
print(21 % 2)
# Prints 4
# 4 / 8 is 0, with a remainder of 4
print(4 % 8)
Concatenation
• The plus sign + can add two str types or Strings (and
not just numeric types)
# prints "HelloWorld!"
a = "Hello"
b = "World!"
c = a + b
print(c)