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

Python Basics

This document is a quick guide to Python basics, covering its syntax, data types, operators, conditional statements, loops, functions, lists, dictionaries, and file handling. It emphasizes Python's simplicity and readability, and encourages daily practice for mastery. The guide includes examples for better understanding of each concept.
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)
14 views2 pages

Python Basics

This document is a quick guide to Python basics, covering its syntax, data types, operators, conditional statements, loops, functions, lists, dictionaries, and file handling. It emphasizes Python's simplicity and readability, and encourages daily practice for mastery. The guide includes examples for better understanding of each concept.
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 Basics - Quick Guide

1. Introduction

Python is a high-level, interpreted programming language known for its simple syntax and
readability.

2. Variables and Data Types

Variables store data values. Python is dynamically typed, so you don't declare types explicitly.

1 int – integers

2 float – decimal numbers

3 str – text

4 bool – True/False

5 list, tuple, set, dict – collections

3. Operators

Type Examples
Arithmetic + - * / % ** //
Comparison == != > < >= <=
Logical and or not

4. Conditional Statements

if, elif, else are used for decision making.

Example: if x > 10: print('Big') else: print('Small')

5. Loops

for and while loops repeat actions.

Example: for i in range(5): print(i)

6. Functions

Functions are reusable blocks of code.


Example: def greet(name): return 'Hello ' + name

7. Lists

Lists store multiple values and are mutable.

Example: nums = [1,2,3] [Link](4)

8. Dictionaries

Store key-value pairs. Example: student = {'name':'Raj', 'age':20}

9. File Handling

open(), read(), write(), close() used to work with files.

10. Conclusion

Practice coding daily to master Python.

You might also like