Thursday, December 9, 2021

python interview questions of inventech solutions

 1.difference between list and tuple?

2.is string is mutable or not?

3.how to remove duplicates from the list

4.what is set in python?

5.what is the lambda function

6.numpy: how to fetch the 5 columns randomly from CSV files

7.How to Copy "A" table with 1 lakh column into empty table "B"

8.query for fetching highest salary employee details from employee table?



Answers:

 1.difference between list and tuple?

ans:



2.is string is mutable or not?

ans: string are immutable. we can't add anything at runtime

3.what is the lambda function

ans:What is Lambda Function in Python? Lambda Function, also referred to as 'Anonymous function' is same as a regular python function but can be defined without a name. While normal functions are defined using the def keyword, anonymous functions are defined using the lambda keyword.

4.how to remove duplicates from the list?


5.what is set in python?

6.numpy: how to fetch the 5 columns randomly from CSV files

7.How to Copy "A" table with 1 lakh column into empty table "B"

8.query for fetching highest salary employee details from employee table?

Wednesday, December 8, 2021

Polymorphism in python

 polymorphism means one function with multiple forms. one function can act like multiple functions.

Example:

#polymorphism


print(len("hello"))


print(len([10,20,30]))



output:

5

3



#your defined  polymorphism


def poly_test(a,b,c=0):

    print(a+b+c)

    

poly_test(10,20)

poly_test(10,20, c=30)


output :

30

60

python classes

 class anil_test2:

    a = 10

    

    def ani_test():

        print(" This class inside function")

        

        

        

print(anil_test2)


python functions test1

 


def anil():

    print("testing the values")

    

anil()


def anil_test():

    print("testing is working")

    

    

anil_test()

Tuesday, May 18, 2021

python interview questions with SOC

 Q1:what are difference between list and tuple?

Q2:what is decorator? what is the use of that?

Q3:what is the dictionary?

Q4:  how to achieve dictionary values with single key?

Q5: how to get ip address in linux ?

Thursday, April 15, 2021

Python online training contents

for python online classes. please contact 8897520530

or whatsup--8897520530

skype-durgam.anil1@gmail.com


for contents please click on below link

Thursday, April 8, 2021

MM32F MCUs delay in ms(milli seconds) and us(microseconds)

static u8 fac_us = 0;
 static u16 fac_ms = 0;
 extern u32 SystemCoreClock;
 void delay_init() 
 SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);
 fac_us = SystemCoreClock / 8000000;
 fac_ms = (u16)fac_us * 1000; } void delay_us(u32 nus) { u32 temp; SysTick->LOAD = nus * fac_us; SysTick->VAL = 0x00; SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk ; do { temp = SysTick->CTRL; } while((temp & 0x01) && !(temp & (1 << 16))); SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk; SysTick->VAL = 0X00; } void delay_ms(u16 nms) { u32 temp; SysTick->LOAD = (u32)nms * fac_ms; SysTick->VAL = 0x00; SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk ; do { temp = SysTick->CTRL; } while((temp & 0x01) && !(temp & (1 << 16))); SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk; SysTick->VAL = 0X00; }

Tuesday, April 6, 2021

input function in python

# -*- coding: utf-8 -*- """ Created on Tue Apr 6 22:22:06 2021 @author: Onyx1 #input from the user #syntax:input() a=input() b=input() print(a+b) a=int(input("please enter number") ) #string type b=int(input("please enter number ")) #string type print(a,type(a)) print(b,type(b)) print(a+b) a=input("enter your name") print(a, type(a)) a =float(input("please enter floating values")) print(a,type(a)) a= int(input("enter number")) print(a,type(a)) """ #raw_input------python 2.x version input

doc string in python

""" #docstring def basha(): ''' company name:Harish company author:Harish program description: addition , substraction, multiplication functions file date of started:06-04-2021 date modified:08-04-2022 second user: '''''' print("Basha") #__doc__ -------> docstring print(basha.__doc__) ''' def basha1(): """ company_name:Harish company author:Harish program description: addition , substraction, multiplication functions file date of started:06-04-2021 date modified:08-04-2022 second user: """ print("Basha") #__doc__ -------> docstring print(type(basha1)) print(basha1.__doc__) '''

Monday, April 5, 2021

operators in python

""" Created on Mon Apr 5 21:18:07 2021 @author: Onyx1 #class-3-05-04-2021 #addition a=10 b=20 print(a+b) #substraction print(b-a) print(a-b) #multiplication print(a*b) #division print(a/b) #floor division print(a//b) #power print(a**b) #python 2.x print("anl") #operators #arthimatic operation #assignment operators #logical operators #conditional #identify #membership #bitwise #arthimatic operation # +,-,*,/,%,//,**---> operators #assignment operators a=10 b=20 a=a+b b=b-a a=a*b print(a) b=30+50 print("b-",b) a=20 b=10 a=a/b print(a) a=20 b=10 a=a//b print(a) a=20 b=10 a=a**b print(a) #logical operators #& | ! #and a=4#0100 b=2#0010 a = a & b print(a) a=10#1010 b=8#1000 a = a & b print(a) a=4 #0100 b=2 #0010 harish=a|b #0110--6 print(harish) #not....not available a=2 #0010 a!=3 #0011 print(a) #conditional operator a=5 a==5 #5==5 if (a==5): print("this is harish") a>5 #comparison greater than a<4 #comparison less than a<=5 #less than or equal to a>=10 # greater than or equal to a!=10 #not equal to #identify #is #is not #is if two values true then return True same object #is not if two value not True then return False same object x=["rose","lilli"] b=["rose","lilli"] a=x #print(a,x) #print(id(a),id(x)) #print(b,id(b)) print(x is a) #true print(x is b) #False print(x is not b)#True print(x is not a)#false """ #membership #in #not in x=["rose","lilli"] print("rose" in x) #if member exist ---true print("chicken" not in x ) #not exist ---true print("lilli" not in x ) #false

Saturday, April 3, 2021

Operations on numbers in python

dd=3
mm=4
yyyy=2021
print(dd,mm,yyyy,end="",sep="kfdjdskjgshgjhsfdjghdsjfg")
print("03-04-2021")
dd=3
mm=4
yyyy=2021
#print("dd-",dd,"mm-",mm,"yyyy-",yyyy,end="",sep="")
#print("03-04-2021")
#print("dd{}-mm-{}-yyyy-{}".format(mm,dd,yyyy))
#print("%d-%d-%d",dd,mm,yyyy)
#print(dd,mm,yyyy)
#boolean=2values
#True----->1
#False---->0
a=True
print(a)
a=False
print(a)
print(True)
print(False)
#operations on number
#+,_,/,%,**,<,>>=,<=,!,!=
#addition---'+'
a=1054545454545454545454421231545313248432132454
b=206545423132468484543545484843415454564545121324874987524154879848544564654564564654548798798
a=a+b
#print(a)
a=a+a+b+a+a+b+b+a+a+b+b+b+b+a+a+b+b+a+a+b+a+b+b+b
b=a+a+b+a+a+b+b+a+a+b+b+b+b+a+a+b+b+a+a+b+a+b+b+b
#print(a+b)
#subtraction ---'-'
a=20
b=10
c=a-b
print(c)
#multiplication---'*'
a=205454564545454545132132156456451234156456451545456456451341
b=10657484564354846454654845645467484546546546
c=454545454546545453423132545454545465456456454554
print(a*b*c)
print(a*b*c*a*b*c)
#BODMAS
#B-brackets
#O-of
#D-division
#M-multiplication
#A-addition
#s--substraction
print((5*4)+10)
#division---'/' a=10
b=2
#print(type(a),type(b))
c=a/b
print(c)
a=10
b=2
#print(type(a),type(b))
c=a/b
print(c)
#floor division
a=11
b=2
#print(type(a),type(b))
c=a//b
print(c)
a=115465454564564545454545454545
b=2
#print(type(a),type(b))
c=a//b
print(c)
#power **
print(2**5)
print((2**5)**2)
print(10**2)
""" print "jyothi laxmi" #2.0
#integer----int
#string-----str
#float------float
#char--------xxxxxx not available

python class topic video