Java, .NET, PHP, PYTHON, ANGULAR, ML, Data Science, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

History & scope  of  Python:- 






Python is a script based language which will be executed by the Python interpreter itself.
The python script is easy to learn and a light-weight script as compare to other programming languages.


A python script was developed by
GUIDO VAN ROSSUM to create a device driver-based application initially.



but now Python is complete technology that is used to develop System Software, Application Software, Data Science, Machine Learning, Interface Programming, Game Development,
Electronic Software Implementation with IoT and Aurdino, Automation Programming for Software Testing.



Python Script performance is best as compare to other languages means its performance is much better as compared to C, CPP, Java, PHP, and Another Programming language.
Python script only focuses on a set of code .it not use code pattern and code structure.


.....................................................................................................................................................

How to run the Python Script:-


1 Online Mode:-


We can run a python script without using any software because Python Software tools are online available.

www.jupyter.org/try

Python Program for Addition


........................................................................................................

Offline Mode:-

python.org  download python software

python 3.9.exe file will be downloaded from here

double click and execute them.

After Successfully installation Python Provide Default IDLE Tools
...............................................................................................................................................................

Python Program Execution:-

1 Python Source Code ------> Run  -----> PYTHON INTERPRETER MACHINE ----> Machine Code----> Output

.....................................................................................................................................

Program to calculate simple interest?

p,r,t=12000,2.2,3.5
si=(p*r*t)/100
print("result is p={0} , r={1} , t={2} ,si={3} ".format(p,r,t,si))
#print("result is %.2f" % si)




Input /Output function for Python Console Application:-


Output Function

print():-   it is used to print a single line statement and multiple line statements both.
print("hello")    #single statement
print("hello","world")  #Multiple Statement
print("hello" + "world")  #Conacatenation
print(" %f " %  1.2345)


input():-  it is used to take input from the user's.

var=input("message") 

input return data in String format


a= int(input("message"))
#program for addition
a=int(input("enter first number"))
b=int(input("enter second number"))
c=a+b
print(c)

#ASSIGNMENT:-

WAP to Calculate the Area of Triangle and Rectangle?

WAP to Reverse Five Digit Number?

WAP to Calculate Addition of Complex Number?



Solution:-

Reverse Program Answer?
num=78125
print("Actual number is",num)
a=num%10  #5
num=num//10 #1234
b=num%10    #4
num=num//10 #123
c=num%10    #3
num=num//10 #12
d=num%10    #2
e=num//10   #1
num1= a*10000+b*1000+c*100+d*10+e*1
print("Reverse of number is",num1)


Addition of complex numbers without using complex()?

r1 = 2
i1 = 3
r2=5
i2=7
r = r1+r2
i = i1+i2
print("{0}+{1}j".format(r1,i1))
print("{0}+{1}j".format(r2,i2))
print("{0}+{1}j".format(r,i))

Addition of a complex number with a complex number:-

num1 = 2+3j
num2 = 4+5j
num = num1+num2
print(num1)
print(num2)
print(num)



20 Comments

If you have any doubt in programming or join online classes then you can contact us by comment .

  1. area of traingle
    b,h=10,20
    Area=(b*h)//2
    print(Area)

    ReplyDelete
  2. area of rectangle
    w,l=20,30
    Area=(20*30)
    print(Area)

    ReplyDelete
  3. adding complex number using complex number
    A=2+3J
    B=3+4J
    C=A+B
    print(A)
    print(B)
    print("addition of complex number",C)

    ReplyDelete

  4. print("Knowing Base and Height")
    h = int(input("Enter height of Triangle :\t"))
    b = int(input("Enter length of the Base :\t"))
    c = b*h/2
    print("\n Area of a Triangle",c)

    ReplyDelete
  5. #Area of a Rectangle
    print(" If length and Width are given")
    b = int(input("Enter Width of Rectangle :\t"))
    l = int(input("Enter length of Rectangle :\t"))
    c = l*b
    print("\n Area of a Rectangle",c)

    ReplyDelete

  6. #Code for Reversing Five Digit Number
    f = str(input("Enter Five Digit No. :\t"))

    l=f[::-1]

    print("Answer :-",l)

    ReplyDelete
  7. Adarsh dixit
    i = int(input("enter a number :"))
    rev = 0
    while (i>0):
    rev=(rev*10)+i%10
    i=i//10
    print("revers=",rev)

    ReplyDelete
  8. Adarsh dixit
    # Three sides of the triangle is a, b and c:
    a = float(input('Enter first side: '))
    b = float(input('Enter second side: '))
    c = float(input('Enter third side: '))

    # calculate the semi-perimeter
    s = (a + b + c) / 2

    # calculate the area
    area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
    print('The area of the triangle is %0.2f' %area)

    ReplyDelete
  9. first = complex(input('enter first complex number: '))
    second = complex(input('enter second complex number: '))

    addition = first + second

    print('sum = ', addition)

    ReplyDelete
  10. Area of traingle
    B=10
    H=30
    Area =(B*H) /2
    Print ("Area")

    ReplyDelete
  11. Area of rectangle
    W, L=20, 25
    Area=(W*L)
    Print("Area")

    ReplyDelete
  12. ***Area of Triangle***
    base=int(input("enter the base of traingle"))
    height=int(input("enter the height of triangle"))
    area=((base*height)*1/2)
    print("area= %d"% area)

    ReplyDelete
  13. ***Area of Rectangle***
    width=int(input("enter the width of ractangle = "))
    height=int(input("enter the height of ractangle = "))
    area=width*height
    print("area= %d"% area)

    ReplyDelete
  14. ***Addition of complex Number***

    a=2+3j
    b=3+2j
    c=a+b
    print(c)

    ReplyDelete
  15. *** 5 digit reverse***
    a=int(input("enter the 5 digit no = "))
    i=a%10
    a=int(a/10)
    j=a%10
    a=int(a/10)
    k=a%10
    a=int(a/10)
    l=a%10
    a=int(a/10)
    print(str(i)+str(j)+str(k)+str(l)+str(a))

    ReplyDelete
  16. #MOhit Chouhan
    Question 1.
    Area Of Triangle
    B=4
    H=5
    area= (1/2*(B*H))
    print("The Area of Triangle is " , area)

    Area of rectangle
    W=20
    L=30
    Area=(W*L)
    print(Area)


    Ques.2
    a=12345
    i=a%10
    print(i) #5
    a=int(a/10)
    print(a) #1234
    j=a%10
    print(j)#4
    a=int(a/10)
    print(a) #123
    k=a%10
    print(k)#3
    a=int(a/10)
    print(a)#12
    l=a%10
    print(l)#2
    a=int(a/10)
    print(a) #1
    print(str(i)+str(j)+str(k)+str(l)+str(a))


    Ques.3 Addition of complex Number?

    a=5+2j
    b=2+5j
    c=a+b
    print(c)

    ReplyDelete
  17. #Mohit Singh Chouhan
    a= 12345
    b=a%10 #5
    v=a//10 #1234
    c=v%10 #4
    w=v//10 #123
    d=w%10 #3
    x=w//10 #12
    e=x%10 #2
    y=x//10 #1

    print(str(b)+str(c)+str(d)+str(e)+str(y))

    ReplyDelete
  18. Area of Triangle
    j= 6
    >>> k= 8
    >>> area= (1/2*(j*k))

    area of rectangle
    l= 10
    >>> b= 5.5
    >>> a= l*b
    >>> print(a)
    >>> print(area)

    ReplyDelete
  19. reverse five digit of 12345

    a=12345
    num=0
    num=(a%10)*10
    a=a//10

    num=(num+(a%10))*10

    a=a//10
    num=(num+(a%10))*10
    a=a//10
    num=(num+(a%10))*10
    a=a//10
    num=(num+(a%10))

    print(num)

    ReplyDelete
  20. addition of a complex no.

    >>> a= 4+5j
    >>> b= 5+6j
    >>> c= a+b
    >>> print(c)
    (9+11j)

    ReplyDelete

Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post