0% found this document useful (0 votes)
6 views6 pages

Python Programming Basics and Features

Python is a high-level, interpreted, general-purpose programming language created by Guido van Rossum in 1991, known for its simple syntax and versatility in fields like web development, data science, and machine learning. Key features include dynamic typing, portability across platforms, and a large standard library. The document also covers basic Python syntax, data types, operators, control structures, and data structures such as strings, lists, and dictionaries.

Uploaded by

darkside7448
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views6 pages

Python Programming Basics and Features

Python is a high-level, interpreted, general-purpose programming language created by Guido van Rossum in 1991, known for its simple syntax and versatility in fields like web development, data science, and machine learning. Key features include dynamic typing, portability across platforms, and a large standard library. The document also covers basic Python syntax, data types, operators, control structures, and data structures such as strings, lists, and dictionaries.

Uploaded by

darkside7448
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Python====

high-level , interpreted, general purpose language

1991 gudio van rossum

simple , beginners

automation , web development , data science , Ai , machine learning

python important features===

simple syntax

interpreted language

dynamically typed== variable ///type declare

portable--- windows , mac, linux all work

large standard library= inbuilt modules

open source

work in python-----

field use

1. web development Django,


Flask
2. Data science Numpy, Pandas, Matplotib
3. Machine learning TensorFlow, Scikit-learn
4. Automation scripts,
Bots
5. Game Development pygame
6. GUI apps Tkinter,PYQT

install------

vs code---
1. extension
2. search ----- python---- publisher by - Microsoft
3. python interpreter set-------key===== ctrl + shift + p
next type === python: Select Interpreter

simple print code===

print("Hello")

than save file name .py

step ----
[Link] folder
2. open folder now path waale me jaa kar usme type cmd than enter
3. cmd me code . than enter
-----=====-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-----
variable & datatype==python jo hota hai wo automatically data type
samjh jata hai
-----------
name = "Sameer"
age = 25
height = 6.1
is_Teacher = True

print(name, age, height, is_Teacher)

--------
name = input("Enter your name: ")
print("Hello", name)

run

terminal==== python filename .py

---------
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))

total = num1 * num2

print("Total is:", total)

Arithmetic operators
1. addition
a = 10
b = 3

print(a+b)

2. Exponent
a = 10
b = 3

print(a ** b)

3. Floor Division

a = 10
b = 3

print(a // b)

-------Assignment operators----
basic assignment
a = 10
b = 3

print(a // b)

addition
x = 61
x += 34
print(x)

-----------------Comparison operators----
code
a = 10
b = 13
print(a < b)

logical operators----

condition ko combine karta hai


1. And----- dono true
x = 10
print(x > 5 and x < 20)

2. Or------- koi ek true hota


x = 10
print(x < 5 or x== 10)

3. not----- ulta kare


x = 10
print(not(x == 10))

BitWise operators----
ye number ke binary bits par kaam karta hai

1. & (AND)

Dono bit 1 honi chahiye tabhi wo 1 hoga

5=0101
3=0011

a = 5
b = 3
0101
&0011
-------
0001(1)

result = a & b
print ("Binary only ", result)

2. BitWise OR(|)
a = 5
b = 3

result = a | b
print("5 | 3 =", result)

3. BitWise XOR(^)
0101
0011
------
0110

a = 5
b = 3
result = a^b
print("5 ^ 3 =",result)

4. bitwise not(~)

a = 6
result = ~a
print("~6 =", result)

5. left shift(<<)
a = 5
result = a << 1
print("5 << 1=", result)

6. Membership operators----

kisi element ka list/string me hona ya nahi hona ye check karta hai

1. in --- value presrnt hai

lst = [1,2,3,4]
print(6 in lst)

2. not in ---- value presrnt nahi hai

lst =[1,2,3,4]
print(5 not in lst)

7. identity operators----
check karta hai ke do variable same object ko point karte hai ya nahi

1. is = same object hai


x = [1,2]
y = [1,2]
z = x

print(x is z)
2. is not = same object nahi hai
x = [1,2]
y = [1,2]
z = x
print( x== y)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-==-=-=-
control structures------==--=
control structures define the flow of extension in a python program - that
means, they decide::

1: conditional statements==
here's a complete explanation of conditional statements
(Decision Making)

1. if statements==
condition true = than run

age = 18
if age >=18:
print("You are eligible to vote")
2. if.....else statements===
any one condition true or not than second condition apply

age = 20
if age >= 30:
print("Eligible to vote")
else:
print("Not eligible to vote")

3. if....elif....else
check to multiple condition

if--- block1
elif--- block2
else;
marks = 75

if marks >= 90:


print("Grade: A")
elif marks >= 80:
print("Grade: B")
elif marks >= 60:
print("Grade: C")
else:
print("Fail")

4. Nested if statements

first if than under second if


x = 10
y = 5

if x > 0:
if y > 0:
print("Both x and y are positive")

========loops =======

statements repeating code

1. While
= condition true than run
i = 1
while i <=100:
print(i)
i +=1

2. For
= sequence (list, string )runnig on code
for i in range(1,10):
print(i)

==========loop control statements========


[Link]
code break on center

for i in range(5):
if i == 2:
break
print(i)
[Link]
iteration

for i in range(5):
if i == 3:
continue
print(i)

[Link]
placeholder

for i in range(5):
if i == 3:
pass
print(i)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=Data structure-=-=-=-=-=-=-=-=-=-=-=-
A data structure, in computer science , is a way of organizing, storing, and
accessing data.

1. String=
A string is a sequence of charaters enclosed in quotes.
string are immutable (a,s,e)

name = "PYTHON"

print(name[4])----output= O
print(len(name))-------= 6
print([Link]())------= PYTHON
print([Link]())------= python

2. Lists
a list is a collection of items in ordered form.
it is mutable
use square brackets[]

student = ["Abhay","Payal","Suraj"]
print(student[2])-----assign
[Link]("Anshu")----add
[Link]("Abhay")----removed
print(student)

3. Tuples
4. Sets
5. Dictionaries

You might also like