Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
15 views

Python Basic Learning

The document outlines key concepts to learn in Python, including Python tutorials, features, history, applications, and installations. It then covers Python syntax like variables, data types, keywords, literals, operations, comments, conditionals, loops, strings, lists, tuples, sets, dictionaries, functions, files I/O, modules, exceptions, dates, regex, CSV files, OOP concepts like classes and inheritance, and more advanced topics like MySQL, environment setup, and real-life examples.

Uploaded by

hypeddivo
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Python Basic Learning

The document outlines key concepts to learn in Python, including Python tutorials, features, history, applications, and installations. It then covers Python syntax like variables, data types, keywords, literals, operations, comments, conditionals, loops, strings, lists, tuples, sets, dictionaries, functions, files I/O, modules, exceptions, dates, regex, CSV files, OOP concepts like classes and inheritance, and more advanced topics like MySQL, environment setup, and real-life examples.

Uploaded by

hypeddivo
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 10

What to learn in Python:

 Python tutorials

 python features

 python history

 python applications

 python installations

 python examples

 python variables

 python data types

 python keywords

 python literals

 python operations

 python comments

 python if/else

 python switch, ternary operators

 python loops

 python for loop, while loop, ranges

 python break, continue, pass

 python string, lists,tuples

 python List vs tuples

 python sets

Page 1 of 10
 python Dictionary

 python function

 python builtin functions

 python lambda functions

 python files i/o

 python modules

 python exceptions

 python date

 python regex

 python sending email

 read CSV files

 write CSV files

 python Assert

 python list comprehensions, collection modules, math modules, Os


modules, random modules, statistics module, sys modules

 python IDE

 Python arrays

 python stack and queue

===============>>>>>>>>>>================

 Python OOP's concepts

 python object class

 python constructors

Page 2 of 10
 python inheritance

 abstractions in Python

================>>>>>>>>>>===============

 Advance Python

 Python MYSQL

 environment setup

 database connections

 creating new database

 creating tables

 insert operations

 read operations

 update operations

 join operations

 performing transactions

================>>>>>>>>>>>==============

 Other common examples in python

 real life usage of Python

-------------------------------------------------------------------

Page 3 of 10
Python Beginners
Course
--------------------------------------------------------------------------------
Rule 1: The variable must begin with a letter (uppercase or lowercase),
or an underscore, NOT a number!
Rule 2: Variables in Python are CapsCase Sensitive.
Rule 3: We cannot use Python Keywords as Variables
Example:
False, await, else, import, pass, None, break, except, in, raise, True,
class, finally, is, return, and, continue, for, lambda, try, as, def, from,
nonlocal, while, assert, del, global, not, with, async, elif, if, or, yield.
--------------------------------------------------------------------------------
Syntax: A set of rules we must follow in all form of communication.
Python can only understand what we tell it!
------------------------------------------------------------------------------------
F-String & String
Lists using String, Integer don't require comma's.
------------------------------------------------------------------------------------

Page 4 of 10
List Methods, extend. append: is used to add single item to the end of
the list!
------------------------------------------------------------------------------------
insert then (0 - 100, "(your variable name)")
.reverse = reverses the list for example
.mark - marks how many variables are found
------------------------------------------------------------------------------------
- comment - use # to write a comment or information about the code!
we want the comment to be short and concise to the point! try to explain
once and as best as you can! this will keep your code looking clean. if
needed to write a long comment, it should be broken up into two seprate
lines. comments are the best way to remind and explain to others what
certain pieces of your code do and will save you tonnes of time!
------------------------------------------------------------------------------------
Index: an index error will arise when we try to call a non-existent index
in a list (zero, one, two, three)
eg:
company_one = ["mark", "paul", "owais", "robert"]
print(f"{company_one[1]} is the hardest worker of the month!)
------------------------------------------------------------------------------------
List in python can become extremely long, having info where we
think it is, is very important!
.sort: organizes list alphabetically, the list will be permanently changed
to alphabetically. eg.
Page 5 of 10
(list_name).sort()
print(list_name)
if you want to reverse the sort list for example zyx add reverse=true
in the brackets .sort()
eg:
list_name.sort(reverse=True)
print(list_name)
Now our list in permanently reversed alphabetically
-
what if you wanted to simply reverse this order in our list?
simply type (list_name).reverse()
print(list_name)
-
In python we cannot sort our lists that have both numerical and
string data types
------------------------------------------------------------------------------------
For Loops In Python are an excellent way to work through every
index of a given loop and perform an action n each item or test for a
certain condition and then apply the action!
ex:
one = ["mark", "paul", "owais","omar"]
for company in company_one:
print(f"{company} is an awesome guy!")

Page 6 of 10
it prints that all the employees are awesome!
------------------------------------------------------------------------------------
how to check if one of our piece of data is in our python list.
in = searches for variable in the lists.
- print("your variable name" in (your list name))
true means its available in your list, false means its not available in
your list.

If or Else
x = ("fish", "dog", "cat")
y = ("shark", "outcopus", "green")

if "fish" in x:
print("fish is in x")
else:
print("fish is not in x")

This will find if fish is in your list or is not in your list!

What is boolean expression?


It is a common way to express to a state a true/false conditional
statement, remember! Boolean can only ever give a true/false value there
is no other possible answers to a Boolean expression.
The Boolean expression prints weather if its false or true! This can be
used by if or else statement just don’t forget to add an equal sign after
the else or if (value).
Page 7 of 10
EXAMPLE
CODE FOR BOOLEAN EXPRESSION
x = "fish"
y = "shark"

if x == y:
print("fish is equal to shark")
else:
print("fish is not equal to shark")

here in the code, x is fish and y is shark so it will print that x is not equal
to y, but! If we change y to fish it will print that x is equal to y.

What is indentation error means in Python?!


An indentation error occurs when an indent is forgot following a section
that expects an indentation, and when the coupled indentation are not the
exact same spacing!
So if you ever have an indentation error just make sure that you have
proper spacing in your code to your loop, function, etc.

What is Range Function in and how can It be


extremely useful in Python?!
It is one of the many ways to generate sequences of numbers within
Python
EXAMPLE
for number in (range(1,10)): #the first number we enter is our starting number, the second number in our ending
number. (Note: Python will print from 1 number before the second like if u put 10 in the second it will print only till

Page 8 of 10
9.
print(number)

z = list(range(1,6))
print(z)

The starting number is included and the ending number is excluded.


For much easier code,
for number in (range(10)):
print number
this will print numbers from 1 till 10.
Adding another comma and number will make Python take steps on the
number u input till it reaches the ending number
Ex.
for z in range(1,11, 3):
print(z)
this will print 1, 4, 7, 10. As you can see it takes 3 steps and prints the
number every each 3 steps.

Tuples in Python
A tuples in Python is very similar to lists except for one thing, The value
within the tuples cannot be changed or altered, they are immutable while
lists are mutable.
Tuples are amazing for things you know will never be changed like
birthdates, names, size of something you are creating and etc.
List contains [] meanwhile tuples contain ()
We’ll use our friends name as a tuple list.
Page 9 of 10
#friendsname as list
friends_name_list = ["Paul", "Owais", "Basel", "Kader", "Affan", "Khan", "Arhum", "Mauhid", "Rayan"]
#friendsname as tuples
friends_name_tuples = ("Paul", "Owais", "Basel", "Kader", "Affan", "Khan", "Arhum", "Mauhid", "Rayan")

first_name = friends_name_tuples[0]
print(first_name)
second_name = friends_name_tuples[1]
#this continues...

Page 10 of 10

You might also like