Module Details
This notebook provides a very quick introduction to the fundamentals building blocks of the Python programming language.
Module Webpage
Course Website
https://knowledgebase.hyperlearning.ai/courses/python-taster-course
Requirements
Contents
Outcomes
Python is an open-source general purpose programming language. This means that it can be used to develop software for a wide variety of tasks. Today Python is used to create and maintain a huge range of computer applications and services including in relation to web applications, cyber security, hacking (both ethical and non-ethical), performing data analysis and media processing, robotics and developing artificial intelligence (AI) systems. Python is a popular choice for those wishing to learn computer programming and computer science fundamentals for the very first time because it is easy to learn, intuitive and is supported by an active global community of software engineers, data scientists and academics.
# String / text
my_first_string = 'Hello world!'
print(my_first_string)
Hello world!
# Numbers
my_first_number = 10
my_second_number = 3.14159
# Booleans
my_first_boolean = True
my_second_boolean = False
In Python, the following rules must be adhered to when choosing names for your variables:
_
character.There also exist conventions which, though they do not need to be adhered to strictly unlike rules, are highly recommended to follow when choosing names for your variables:
_
character.# Examples of compliant and good variable names
first_name = 'Jillur'
last_name = 'Quddus'
age = 30
male = True
print(f'{first_name} {last_name} is {age} years old.')
Jillur Quddus is 30 years old.
# Arithmetic operators
print(3 + 7)
print(10 - 6)
print(2 * 3)
print(10 / 2)
10 4 6 5.0
x = 2
y = 10
z = x * y
print(z)
20
# Comparison operators
print(10 == 100)
print(15 != 20)
print(2 > 10)
print(10 < 100)
print(10 >= 10)
print(20 <= 19)
False True False True True False
# If statement
age = 30
if age >= 18:
print("You are allowed to vote in UK elections.")
You are allowed to vote in UK elections.
if age >= 18:
print("You are allowed to vote in UK elections.")
else:
print("You are NOT allowed to vote in UK elections.")
You are allowed to vote in UK elections.
# Print function
name = 'Jillur Quddus'
print(name)
Jillur Quddus
# Defining your own functions
def add(x, y):
sum = x + y
return sum
# Running your own functions
add(10, 20)
30
Take our free Introduction to Python course and become a certified Python developer!