Initializing Core...
Initializing Core...
Operational
We'll learn the syntax and variables used in Python.
Python has a very simple and clean syntax, which makes it beginner-friendly.
print("Hello, World!")
Thus prints - Hello, World! Input and Output :
name = input("Enter your name: ")print("Hello,", name, "! Welcome!")#Enter your name: Rohan#Hello, Rohan"! Welcome!
In Python, we assign variables some value. Below are a few examples.
x = 10 # intpi = 3.14 # floatname = "Zarine" # stris_ok = True # bool
💡 In Python, variables are case-sensitive (Name and name are different).
This is how we assign multiple variables at the same time!
a, b, c = 1, 2, 3x = y = z = 0 # all assigned to 0
There are some rules to be followed while naming a variable.
Valid examples:
user_name = "Alice"marks1 = 90_total = 100
Invalid:
1value = 5 # ❌ cannot start with numberfor = 10 # ❌ cannot use keyword
Single line:
# This is a comment
Multi-line (docstring style):
"""This is amulti-line comment"""
Create three variables: age, pi, student_name. Assign appropriate values and print them.