0% found this document useful (0 votes)
7 views12 pages

Python Basic Syntaxes and Functions

Python is an open-source, object-oriented, high-level programming language suitable for various applications such as data analysis, machine learning, and web development. Jupyter Notebook is a web-based tool for creating interactive documents that include live code and visualizations. The document also covers Python syntax, comments, variables, and the importance of indentation in coding.

Uploaded by

cethan.chua
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views12 pages

Python Basic Syntaxes and Functions

Python is an open-source, object-oriented, high-level programming language suitable for various applications such as data analysis, machine learning, and web development. Jupyter Notebook is a web-based tool for creating interactive documents that include live code and visualizations. The document also covers Python syntax, comments, variables, and the importance of indentation in coding.

Uploaded by

cethan.chua
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Introduction to Python

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?

Data Analysis and Visualization

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!”)

The “print” syntax is used to display the text (“inside here.”)


Some Python built-in functions
• input() – requests for user input.
• len() – returns the length of an object.
• min(), max() – returns the minimum and maximum integers.
• round() – rounds off the integers.
• type() – returns the variable’s data type.
Comments
• Mainly for in-code documentation.
• Starts with #

# 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”

Are different variables.


Indentation
if 5 > 2:
print(“Five is greater than two!”)

• Indentation in Python is very important.


• Indicates a block of code.

You might also like