Python & SQL BibleChapter 221

Basic Python Syntax

Section 1 of 6-~ 12 min read-Synced from Cuantum content
  1. Print Function
print("Hello, World!")
  1. Variable Assignment
x = 5y = "Hello, World!"
  1. Comments
# This is a single line comment"""This is amulti-line comment"""
  1. Conditional Statements
if x > y:    print("x is greater than y")elif x < y:    print("x is less than y")else:    print("x is equal to y")
  1. Loops
for i in range(5):    print(i) while x < 10:    print(x)    x += 1
  1. Functions
def my_function():    print("Hello from a function")