Python Basic

  Python

Email

Python Programming :

 

  • Function string

garage= “anil”,”coding fiels”

sub =”sdfjhsfh”

for anilnaik in garage:

 

 

print(anilnaik)

 

 

2)while loop:

#while loop coding

conditaion = 1

while conditaion > 1:

print(“anilnaik”)

 

3)For loop:

#for looping

sub =[1,2,3,4,4,5,5]

for anil in sub:

print (anil)

 

4)For Loogin In Rage using

#for looping usin range

for sub in range(1,12):

print(sub)

if sub ==10:

print(‘anil’)

else:

break

 

 

 

 

 

 

 

 

 

5)if condiation progaming:

# if and else statment progaming usig

 

a= 10

b=20

if a>b:

print(a)

else:

print(b)

 

 

6) if else codintion working

a =20

b=30

c=40

if a> b:

print(‘a’)

elif a>c:

print(c)

else:

print(a)

 

 

Function :

def anil():

print(‘anilnaika’)

x = 3+9

print(x)

anil()

 

 

 

 

Function with parameter using

#function with parametiar using

def sum(a, b):

sub= a+b;

print(sub)

sum(4,5)

 

 

Function with default parameter using

 

#function with deft parametiar using

def sum(a=3, b=5):

sub= a+b;

print(sub)

sum()

 

 

Goble variable and local varibele

# goble varibale and local varibale

 

x = 10

y=20

def sum():

a=30

c=30

sub= a+c

print(sub)

def sub():

print(x+y)

 

sum()

sub()

 

 

#file hading function :

 

# file hading function python

 

text =”ajkjajkdfkjafnNew Linie!”

savefile =open(‘anil.txt’,’w’)

savefile.write(text)

savefile.close()

 

 

appending files in pyhon

appendMe = ‘nNew bit of information’

 

appendFile = open(‘exampleFile.txt’,’a’)

appendFile.write(appendMe)

appendFile.close()

 

 

Reading files in python

 

readMe = open(‘exampleFile.txt’,’r’).readlines()

print(readMe)

 

 

Input function of in pyhon

#input function

 

x = input(“what is yor name:”)

print(‘hello ‘,x)

 

 

Static function using

import statistics

 

example_list = [5,2,5,6,1,2,6,7,2,6,3,5,5]

 

x = statistics.mean(example_list)

print(x)

 

y = statistics.median(example_list)

print(y)

 

z = statistics.mode(example_list)

print(z)

 

a = statistics.stdev(example_list)

print(a)

 

b = statistics.variance(example_list)

print(b)

 

from Static Import coding files

from statistics import mean, median

# here we imported 2 functions.

anil=[2,3,4,5,5,5]

print(median(anil))

 

 

list expel:

 

def example():

return 15, 12

x, y = example()

print(x,y)

 

tuple :

x = [1,3,5,6,2,1,6]

print(x)

 

print(x[0],x[1])

 

tupel all deails of coding :

 

y = [‘Jan’,’Dan’,’Bob’,’Alice’,’Jon’,’Jack’]

y.sort()

print(y)

y.reverse()

print(y)

 

x = [1,6,3,2,6,1,2,6,7]

 

x.append(55)

print(x)

 

x.insert(2,33)

print(x)

 

x.remove(6)

print(x)

 

print(x[5])

 

print(x.index(1))

 

print(x.count(1))

 

Multi-dimensional lists

x = [[2,6],[6,2],[8,2],[5,12]]

print(x[2])

CSV file coding :

import csv

 

with open(‘example.csv’) as csvfile:

readCSV = csv.reader(csvfile, delimiter=’,’)

dates = []

colors = []

for row in readCSV:

color = row[3]

date = row[0]

 

dates.append(date)

colors.append(color)

 

print(dates)

print(colors)

 

 

 

whatColor = input(‘What color do you wish to know the date of?:’)

coldex = colors.index(whatColor)

theDate = dates[coldex]

print(‘The date of’,whatColor,’is:’,theDate)

 

 

 

Mutile line print

 

 

print(

”’

This

is

a

test

”’

)

 

print(

”’

So it works like a multi-line

comment, but it will print out.

 

You can make kewl designs like this:

 

==============

|            |

|            |

|    BOX     |

|            |

|            |

==============

”’

)

 

 

Dictionary in Python

 

exDict = {‘Jack’:15,’Bob’:22,’Alice’:12,’Kevin’:17}

 

print(exDict)

print(exDict[‘Jack’])

 

exDict[‘Tim’] = 14

print(exDict)

 

 

Build in function python :

#abluste value

exNum1 = -5

exNum2 = 5

print(abs(exNum1))

if abs(exNum1) == exNum2:

print(‘True!’)

 

#help

help()

#time

 

import time

 

help(time)

 

#Max and Minm

 

exList = [5,2,1,6,7]

 

largest = max(exList)

print(largest)

 

smallest = min(exList)

print(smallest)

 

#Rounding

x = 5.622

x = round(x)

print(x)

 

y = 5.256

y = round(y)

print(y)

 

#Convert type string to integer type

 

intMe = ’55’

intMe = int(intMe)

print(intMe)

 

# insteger to string

 

stringMe = 55

stringMe = str(stringMe)

print(stringMe)

 

#convert to foalteing

floatMe = 55

floatMe = float(floatMe)

print(floatMe)

 

Ptyho dirertoy create file create

 

import os

 

curdir =os.getcwd()

print(curdir)

os.mkdir(‘newDir’)

os.rename(‘newDir’,’newDir2′)

 

import sys

 

sys.stderr.write(‘This is stderr textn’)

sys.stderr.flush()

sys.stdout.write(‘This is stdout textn’)

 

URL in import and reading the :

 

#Used to make requests

import urllib.request

 

x = urllib.request.urlopen(‘https://www.eooglo.com/’)

print(x.read())

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1) Data Analysis

2) Robotics

3) Web Development

4) Game Developmnet

5) python fundamentals

6) Bots

7)GUIS

8) go

 

  • Python GUIS application development step and details

Main is the step

1)pyQt

2) Tkint

3) Kivy Basice

 

Py QT :

 

PyQT is a Python wrapper around the QT framework for creating graphical user interfaces, or GUIs

QT framework URL : https://www.qt.io/download

 

Spread the Code

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of