0% found this document useful (0 votes)
2 views2 pages

Python_Punctuation_Guide

This document is a beginner-friendly guide to Python's punctuation and syntax, detailing the meaning and usage of various symbols. It includes a punctuation dictionary with examples, explains how to read a Python sentence, and emphasizes the structured nature of Python code. Understanding these symbols helps make Python code more comprehensible and less intimidating.

Uploaded by

sophiaololade8
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)
2 views2 pages

Python_Punctuation_Guide

This document is a beginner-friendly guide to Python's punctuation and syntax, detailing the meaning and usage of various symbols. It includes a punctuation dictionary with examples, explains how to read a Python sentence, and emphasizes the structured nature of Python code. Understanding these symbols helps make Python code more comprehensible and less intimidating.

Uploaded by

sophiaololade8
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

■ Python Punctuation & Syntax Guide

A beginner-friendly guide to what Python's symbols mean and how to read them.

1. The punctuation dictionary


Symbol Name Meaning Example

() Parentheses Group things or give arguments to a function. print("Hello")


len("Python")

, Comma Separates items or arguments. print("Hello",


"Sophia")

: Colon Introduces a code block, or connects a dictionary key toif


its value.
age >= 18:
print("Adult")

"name": "Sophia"

Indentation Spacing Shows which code belongs to the block above it. Usually
if4 spaces.
age >= 18:
print("Adult")

"" / '' Quotation marks Marks literal text (a string). name = "Sophia"

= Assignment Stores a value in a variable. age = 19

== Equality comparison Asks whether two values are equal. age == 19

!= Not equal Checks whether two values are different. age != 18

[] Square brackets Create/access list items. fruits = ["apple",


"banana"]
fruits[0]

{} Curly brackets Create dictionaries or sets. person = {"name":


"Sophia", "age": 19}

# Comment A note for humans that Python ignores. # This is a comment

+ Add/combine Adds numbers or combines strings. 5 + 3


"Hello " + "Sophia"

- Subtract Subtracts values. 10 - 3

* Multiply/repeat Multiplies numbers or repeats strings. 5 * 3


"ha" * 3

/ Division Divides values. 10 / 2

// Floor division Keeps the whole-number portion of division. 10 // 3

% Modulo Returns the remainder. 10 % 3 # 1

>/< Comparison Greater than / less than. 5 > 3


5 < 3

>= / <= Comparison Greater/less than or equal to. age >= 18


age <= 20

; Semicolon Can separate statements, but Python normally does notx require
= 5; it.y = 10
2. How to read a Python sentence
Example:
age = 19

if age >= 18:


print("You are an adult", age)

Translation:

• age = 19 → store 19 inside age.


• if age >= 18: → if age is at least 18, begin the instructions for that condition.
• : → the block starts here.
• indentation → the print instruction belongs to the if statement.
• () → contains what is being given to print.
• , → separates the two things being printed.
• quotation marks → mark literal text.

3. The big idea


Python has a grammar. The symbols tell Python how pieces of information relate to one another. Once you
understand the punctuation, code starts looking much less like random symbols and much more like a
sentence with structure.

You might also like