Welcome,

To

HarunWebsite

This web site is only for basic In upcoming days Will be in high range.

Portfolio

Course

Python programming:   Python is a popular programming language. It was created by Guido van Rossum, and released in 1991

Basic

Syntax, Variables, Data types, Comments, Operators, Decision Making, Loops, Sequences, Functions, Modules, FilesI/O, Exceptions.

Advance

Class & Objects, CGI programming, Network programming, GUI programming, Extension Programming, Python magic method, PySpark MLlip, web Scapping, Python JSON, Python Itertools, Python Multiprossing.

Python with AI

AI with Python, Machine Learning, Data Preparation, Logic Programming, Analyzing Time series Data, Speech Recognition, Heuristic Search, Gaming, Neaural Networks, Reinforcement Learning, Computer vision, Application AI, Informed Search algorithm, Hill climbing Algorithms in AI, Means-Ends Analysis in AI.

Topics On Python

Basic

First program based on Syntax:

  Let us execute programs in different modes of programming.
Here using print() to print our output and it will be visible on monitor.
=>print "hello world":   It prints hello world
some times we use such as =>print('hello world')

Variables:
a= 10        # a is a variable to assign the value
A= 10      # b also a variable
print(a)      # we got 10 (ans)
Whenever we want to combine the variables such as harun python like that
_harun_python="harun "
print(_harun_python)      # harun
Here the variable are not start with numbers or special symbols.it will start with alphbates and undersore(_)
Eg:->
3a=10 #SyntaxError: invalid decimal literal
3s=20
print(3a+3s)
Variable start with underscore(_)
_a=20
_b=40
print(_a+_b)     # 60
"""a = 10
b = 20
_a_b = 40
king_queen = "good"
decimalOfNumber = 10.99"""

 
Data Types:
These are used to know the What type of Value assigned in the information.
Then easy to modify or alter the data in our desier thoughts.
----- int data type -----
n=20
z=30.18
y=5+3j
print(type(n))    #int
print(type(z))    #float
print(type(y))    #complex
converting into binary, oct, hex
h=20
print(bin(h))    #0b10100
print(oct(h))    #0o24
print(hex(h))    #0x14
----- float data type -----
float is nothing but it is a decimal point such as (1.0,20.9)
n = 22.90
b = 19
z = 4.2
print(type(n))    #class 'float'
print(float(b))    #19.0
----- complex data type -----
n = 1+5j
z = 4+4j
print(type(n))    #complex
print(n+z)   #5+9j

Operators

Any symbol that performs an operation will be called as Operator.
the value on which the operation is performed are called as 'operands.


 
8 types of a operators in python....!
1.Arthematic operators
2.Assignment operators
3.Unary operators
4.Relational operators
5.Logical operators
6.Bitwise operators
7.Membership operators
8.identity operators

1.Arthematic operators
these operatorswill perform simple mathematical calculations or arthematic operations
thats are ' + , - , *, / ,// ,% ,** '''
a = 2
b = 3
print(a)
print(b)
print("sum",a+b)
print("sub",a-b)
print("mul",a*b)
print("div",a/b)
print("flordiv",a//b)
print("mod",a%b)
print("power",a**b)"""

2.Assignment operators
this operator is used to assign a value to a variable. the assignment operator is =.
let see
a = 10
b = 20
print("before swapping",a,b)
a = 10
b = 20
a,b = b,a
print("after swapping",a,b)
if the assignment operator is combined with another operator the it is called compound assignment operator. such as +=,-=,*=,/=,//=,%=,**=. lets see operation by program.
a=2
a = a+1
b=3
b = b-4
c=3
c = c*5
d=4
d = d/6
e=4
e = e//8
f=5
f = f%10
g=3
g = g**2
print(a)
print(b)
print(c)
print(d)
print(e)
print(f)
print(g)

3.Unary operator
this operator works on single operand.this is used for to convert from negative to positive and positive to negative.'''
x = -(5)
print(x)
y = -(-5)
print(y)

4.Relational operator
this operator is used for comparing the values. the relational operator is also known as comaprision operator. such that <= , >= , > , <, ==, !=
a = 10
b = 20
print(a<=b)
print(a>b)
z = 10
y = 10
print(z==y)
print(z!=y)

5.Bitwise operator
x=5
y=6
print(~x) #negation operator
print(x&y) #bitwise AND operation
print(x|y) #bitwise OR operation
print(x^y) #bitwise X-OR operation
print(x<<,1) #left shift operator
print(x>>1) # right shift operator

6.identity operator
x = 5
print(id(x))
y = 6
print(id(y))
print(x is y)
print(x is not y)

7. membership operator
'in'     'notin'
msg ='all is well '
a = 'good'
b = 'Well'
print(a not in msg)
print(b not in msg)

String Data type

Coding is Love


 
s1=" hello"
s2=" harun"
print(s1+ s2)
print(s1 * 5)
print(s2 * 5)'''
indexing string
 
variabel with value => clg = 'Harun Python Programmer'
print(len(clg))
print(clg[3]) # u
print(clg[-1]) """ # r
slicing of string:
print(clg[0:5]) #harun
print(clg[1:18:2]) #remmargorp nohtyp
print(clg[-1::-1]) #remmargorp nohtyp nurah
print(clg[5::-1]) ''' #nurah
membership operation in str
operations are 'in (or) not in'.
print('harun' in clg) #True
print('madhu' in clg) # False
print('harun' not in clg) #False
print('madhu' not in clg)''' #True
=>31 methods in string such as given below str with methods.
 
Take a string: clg="Harun Python Programmer"
1.lower()   use like this ==> : clg.lower()
2.upper()
3.capitalize()
4.title()
5.swapcase()
6.startwith()
7.endwith()
8.count()
9.find()
10.index()
11.join()
12.split()
13.strip()
14.lstrip()
15.rstrip()
16.zfill()
17.replace()
18.center()
19.encode()
20.isalpha()
21.isdigit()
22.isalnum()
23.isidentifier()
24.islower()
25.isupper()
26.isprintable()
27.isspace()
28.istitle()
29.len()
30.min()
31.max()

CONTROL STATEMENTS

Conditional Statements

if statement:
if statement is used for execute a group of the statements based on the result of the condition

To check number is positive or not
num = 10
if num>0:
print("positive number")
with else
num = -30
if num>0:
print("positive number")
else:
print("negative number")

input() function :- it is a function to read the data from user . such as given below.
num = int(input("enter a number : "))
print(num)
print(type(num))

To check the number is odd or even
n = int(input("enter a number : "))
if n%2==0:
print(n,"is even number")
else:
print(n,"is odd number")'''

To check smallest number of two numbers
a = int(input("enter a number : "))
b = int(input("enter b number :"))
if a<.b:
print("a is smallest number")
elif a>b:
print("b is smallest number")
else:
print("both are equal")'''

To check smallest number of three numbers
a = int(input("enter first number :"))
b = int(input("enter second number :"))
c = int(input("enter third number :"))
if a<.b and a<.c: (remove".")
print("a is smallet number among b and c")
elif b<.a and b<.c:
print("b is smallest number among a and c")
else:
print("c is smallest number among a and b")'''

To chect the date is valid or not
date = input("enter a date : ")
dd,mm,yy = date.split('/')
dd = int(dd)
mm = int(mm)
yy = int(yy)
if mm==1 or mm==3 or mm==5 or mm==7 or mm==8 or mm==10 or mm==12:
max1 = 31
elif mm==4 or mm==6 or mm==9 or mm==11:
max1 = 30
elif yy%4==0 and yy%100!=0 or yy%400==0:
max1 = 29
else:
max1 = 28
if dd<1 or dd>max1:
print("date is invalid")
elif mm<1 or mm>12:
print("date is invalid")
else:
print("date is valid")'''

To check grade of the students
marks = int(input("enter marks :"))
if marks>=35:
if marks>=75 and marks<=100:
print("you are in the list of distinction........!")
elif marks>=60 and marks<.75:
print("you are in the list of first class")
elif marks>=50 and marks<.60:
print("you are in the list of second class")
else:
print("you are in the list of third class")
else:
print("write again exam in next sem ....!")'''

To check year leap or not in single line of IF condition.
year = int(input("enter a year :"))
print(year,"is leap year ") if year%4==0 else print(year,"is not leap year")

Iterating Statements
=======FOR LOOP=====:-------
For loop:- it is used for the executing group of statements multiple lines.
we know the exact number of iterations.

I need to print 10 number from 1 to 10 using for loop
count = 0
for x in range(1,6):
print(x)
count = count+x
print(count)

To print reverse number from 10 to 1.
sum = 0
for x in range(10,0,-1):
print(x)
sum = sum+x
print("sum of all numbers")
print(sum)

To print letters one by one
data = 'harun python programmer'
for x in data:
print(x)

To print tables by taking the number from user
number = int(input("enter a number for table :"))
for x in range(1,11):
print(number,"*",x,"=",number*x)

using function
def table(number):
for x in range(1, 11):
print(number, "*", x, "=", number * x)
table(2)

Display even numbers from one range to another range
x = int(input("enter lower range : "))
y = int(input("enter higher range :"))
for i in range(x,y+1):
if i%2!=0:
print(i)

To display star pattern
for i in range(1,11):
print(i*'*')
Reverse pattern
for i in range(10,0,-1):
print((10-i)*' '+i*'*')# for space (10-i)multiple with spaces like (' ')

To check given number is prime or not
num = int(input("enter a number : "))
sum = 0
for x in range(1,num+1):
if num%x==0:
sum = sum+1
if sum==2:
print("prime number")
else:
print("not a prime number")

To check number is perfect or not
num = int(input("enter a number : "))
sum = 0
for x in range(1,num):
if num%x==0:
sum = sum+x
if sum==num:
print("perfect number")
else:
print("not a perfect number")

To check in the string how many digits and characters
msg = 'harun14321561'
digit = 0
char = 0
for i in msg:
if i.isdigit():
digit = digit+1
char = char+1
print("number of digits in msg",digit)
print("number of character in msg",char)

To check in string how many is lower and upper
name = "harunPYTHONProgrammer"
l = 0
u = 0
for x in name:
if x.islower():
l = l+1
elif x.isupper():
u = u+1
print("lower in name :",l)
print("upper in name",u)

Fibonacci series
num = int(input("enter a number of terms :"))
a=0
b=1
for x in range(1,num+1):
c = a+b
a = b
b = c
print(a)

Factorial of number
num = int(input("enter a number :"))
fact = 1
for x in range(1,num+1):
fact = fact*x
print("the factorial of",num,"is",fact)

=====WHILE LOOP====:=--
while loop:- we don't know exact number of itarations
To print numbers from 1 to 10 using while
i = 1
while i<=10:
print(i)
i = i+1

To print number and know sum of numbers
i =1
n = 0
while i<=10:
print(i)
n = n+i
i = i+1
print("sum of numbers")
print(n)

To sum the numers upto specified capacity
i=1
n=0
capacity=30
while n<=capacity:
print(i)
n = n+i
i = i+1
print(n)

sum of digts by while
n = int(input("enter a number :"))
total =0
while(n>0):
rem = n%10
total = total + rem
n = n//10
print(total)

To check the reverse of number
n = int(input("enter a number :"))
rev =0
while n>0:
rem = n%10
rev = rev*10+rem
n = n//10
print("reverse of number:",rev)

To check given number is palindrome or not
n = int(input("enter a number :"))
rev = 0
num = n
while n>0:
rem =n%10
rev = rev*10+rem
n=n//10
if rev==num:
print(" given number is palindrome number")
else:
print("given number is not a palindrome")

To check number is armstrong or not
n = int(input("enter a number :"))
total =0
temp = n
while n>0:
rem = n%10
total = total+rem**3
n = n//10
if total==temp:
print("given number is armstrong")
else:
print("given number is not a armstrong")'''

program for fibonacci series
nterms=int(input("how many terms :"))
n1=0
n2=1
count=0
if nterms==1:
print("fibonacci sequence upto",nterms,":",n1)
else:
print("fibonacci sequence upto",nterms,":")
while count<.nterms:
print(n1,end=",")
n3=n1+n2
n1=n2
n2=n3
count = count+1

To count number of digits
n = int(input("enter a number :"))
count = 0
while n > 0:
count = count+1 #it counts how many numbers we entered
n = n//10
print(count)

To display prime number using nested loo
for num in range(1,101):
count=0
for x in range(1,num+1):
if num%x==0:
count!=1
if count==2:
print(num)

To display identity matrix
n = int(input("enter matrix :"))
for i in range(0,n):
for j in range(0,n):
if(i==j):
print("1",sep=" ",end=" ")
else:
print("0",sep=" ",end=" ")
print()

multiple two matrices
x = [[1,2,3],
[4,5,6],
[7,8,9]]
y = [[5,1,2],
[6,7,3],
[4,5,1]]
result = [[0,0,0],
[0,0,0],
[0,0,0,]]
for i in range(len(x)):
for j in range(len(y[0])):
for k in range(len(y)):
result[i][j]=result[i][j]+x[i][k]*y[k][j]
for r in result:
print(r)

Transfer statements
break pass continue
=====break========
To print sum of number upto specified capacity
i=1
total=0
capacity=25
while True:
print(i)
total = total + i
i = i+1
if total > capacity:
break
else:
print("we have reached the maximum limit")
print(total)

=====continue=======
print 1 to 10 expect 7
for x in range(1,11):
if x==7:
continue
print(x)

To print a string without consonants
data = 'harun pyhton programmer'
for x in data:
if x=='a' or x=='e' or x=='i' or x=='o' or x=='u':
continue
print(x)

=======pass=======
count the number of character except one letter
data = "harun"
n=0
for x in data:
if(x=="h"):
pass
else:
n=n+1
print(n)

wap to count number of vowels in a string
n=0
data ='harun'
for x in data:
if x == 'a' or x == 'e' or x == 'i' or x == 'o' or x == 'u':
n=n+1
print(n)'''

========LIST============
lis_name=[10,20,30] #first way
print(type(lis_name))'''
list can be empty
data = []
print(type(data))

2nd way of list
name = list()
data = list(range(1,11))
print(data)

making list on strings
msg='harun python programmer'
data =list(msg)
print(data)
CONCATINATION OF LIST := we can create a list by concatenation of two lists
a=[1,2,3]
b=[4,5,6]
print(a+b)
REPETITION OPERATOR ON LIST := we can create list by repeating elements
a=[1,2,3]
print(a*2)
Indexing:= it is a process of accessing an element from list based on index position
data = [1,2,3,'g','h','j',4]
print(data[4])
print(data[-1])'''
Slicing := it is a process of accessing a group of elements
data = [0,1,2,3,4,5,6,7,8,9]
print(data[0:5])
print(data[2:])
print(data[:7])'''
Membership operation on list
data = [1,2,3,4,5,6,7,8,9]
print(10 in data)
print(2 in data)
print("h" in data)
print('h' not in data )

END

Programmer Rule


If any code runs don't touch it :

This is going to end because this is only for the basic.
In upcoming days will be available large web site.
=======Thank You====== for visting this website ....!!!!!!!!!!!

img

About web page

Python Language

This web page was introduced about Python Language. This will be helpfull to poor in programming language. It will be healpfull to learn basic about python language. In this page we are included about basic knowledge on python programming. we are providing a basic language upon corresponding at learning stage!

Contact info

Phone

+91 9182257621

Email

shaikharun46@gmail.com

Address

Annamaya, Andhra pradesh, India