Dalam artikel ini kita akan belajar Python Basic, dimana dasar-dasar inilah yang perlu kita kuasai. Dalam pengkodean yang diperlukan adalah penalaran, bukan dihafal, hanya dengan mengerjakan langkah demi langkah kita akan menegerti bagaimana cara kerjanya.
Materi ini disusun dari dasar sampai ketingkat yang lebih tinggi agar mudah dipahami setiap prosesnya.
1. Overview
2. Syntax
- Open jupyter notebook
- Input this code
Teks:
In [1]: print("Hello World")
Hello World
In [2]: if 10 > 2:
File "<ipython-input-2-443bce53a084>", line 1
if 10 > 2:
^
SyntaxError: unexpected EOF while parsing
In [3]: if 5 > 2:
print("Five is greater than two!")
Five is greater than two!
In [4]: if 10 > 2:
print("Ten is greater than two")
Ten is greater than two
3. Comments
In [1]: print("Hello World")
Hello World
In [2]: if 10 > 2:
File "<ipython-input-2-443bce53a084>", line 1
if 10 > 2:
^
SyntaxError: unexpected EOF while parsing
In [3]: if 5 > 2:
print("Five is greater than two!")
Five is greater than two!
In [4]: if 10 > 2:
print("Ten is greater than two")
Ten is greater than two
#This is my first Python Script 10/5/2026 9:33 PM Eastern Time
print('Hello World')
#print("Hello World")
#this is not going to run print(5+2)
#don't let this code run print("Hello My Friends")
#this is not allowed to run at this time print (5+2)
#print("Hello World")
#print("Hello Asia")