Python Basic Syntaxes and Functions
Python Basic Syntaxes and Functions
What is Python?
• Open-source: it's free and available
for further improvements, like
adding helpful features or fixing bugs
• Object-oriented: based not on
functions but on objects with
defined attributes and methods
• High-level: human-friendly rather
than computer-friendly
• General purpose: can be used to
create any kind of programs
What can you do with Python?
Machine Learning
Software Development
Web Development
Automation/Scripting
What is Jupyter Notebook?
• Web-based application used to
create and share interactive
notebook documents, which can
contain live code, text, data
visualizations, videos and other
computational outputs.
Python Syntax, Comments, and
Variables
Executing basic syntaxes
print(“Hello world!”)
# This is a comment
# Comments do not interfere with the rest of the code
Variables
a = “Apple”
b = “Banana”
Print(a)
• Used for assigning values.
Variable Casting
apple = str(“Apple”)
sample_integer = int(5)
sample_float = float(3.5)
• Used for assigning values.
• str() – returns the values as text, should be enclosed in “ “ or ‘ ‘
• int() – returns the value as an integer.
• float() – returns the value as decimal.
Variable Casting
Variables are case sensitive, which means that:
z = “zebra”
Z = “Zebra”