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

Python Reference Guide

This document serves as a quick reference guide for common Python operations and syntax, covering data types, control flow, and functions. It includes examples for various data types such as integers, floats, strings, and lists, as well as control flow structures like if statements and loops. Additionally, it provides information on defining functions, using lambda functions, and list comprehensions.

Uploaded by

yohifim560
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)
4 views2 pages

Python Reference Guide

This document serves as a quick reference guide for common Python operations and syntax, covering data types, control flow, and functions. It includes examples for various data types such as integers, floats, strings, and lists, as well as control flow structures like if statements and loops. Additionally, it provides information on defining functions, using lambda functions, and list comprehensions.

Uploaded by

yohifim560
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 Quick Reference Guide

A handy reference for common Python operations and syntax.

Data Types
Type Example Description

int 42 Integer numbers


float 3.14 Decimal numbers
str "Hello" Text strings
bool True/False Boolean values
list [1, 2, 3] Ordered, mutable sequence
tuple (1, 2, 3) Ordered, immutable sequence
dict {'key': 'value'} Key-value pairs
set {1, 2, 3} Unordered unique items

Control Flow
If Statement:
if condition:
# code block
elif other_condition:
# code block
else:
# code block

For Loop:
for item in iterable:
# code block

While Loop:
while condition:
# code block

Functions
Define a Function:
def function_name(param1, param2):
result = param1 + param2
return result

Lambda Functions:
square = lambda x: x**2

List Comprehension:
squares = [x**2 for x in range(10)]

You might also like