التخطي إلى المحتوى الرئيسي

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)

تعليقات

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

    ردحذف
  2. area of rectangle
    w,l=20,30
    Area=(20*30)
    print(Area)

    ردحذف
  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)

    ردحذف

  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)

    ردحذف
  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)

    ردحذف

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

    l=f[::-1]

    print("Answer :-",l)

    ردحذف
  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)

    ردحذف
  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)

    ردحذف
  9. first = complex(input('enter first complex number: '))
    second = complex(input('enter second complex number: '))

    addition = first + second

    print('sum = ', addition)

    ردحذف
  10. Area of traingle
    B=10
    H=30
    Area =(B*H) /2
    Print ("Area")

    ردحذف
  11. Area of rectangle
    W, L=20, 25
    Area=(W*L)
    Print("Area")

    ردحذف
  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)

    ردحذف
  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)

    ردحذف
  14. ***Addition of complex Number***

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

    ردحذف
  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))

    ردحذف
  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)

    ردحذف
  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))

    ردحذف
  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)

    ردحذف
  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)

    ردحذف
  20. addition of a complex no.

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

    ردحذف
  21. #WAP to Reverse Five Digit Number?
    num=10021
    a=num%10 #1
    num=num//10 #
    b=num%10 #2
    num=num//10 #
    c=num%10 #0
    num=num//10 #
    d=num%10 #0
    num=num//10 #
    e=num%10 #1
    num1=(a*10000+b*1000+c*100+d*10+e*1) # 10000 is place value
    print(num1)







    ردحذف
  22. #1 wap to addition complex number
    com=4+5j
    com1=6+15j
    com2=com+com1
    print(com2)

    # 2 wap to find the reminder
    # %( reminder)
    a=22
    b= a%3
    print(b)

    ردحذف
  23. #WAP to calculate the area of a triangle, circle, and rectangle ?
    h=15
    b=20
    l=30
    r=10
    pi=3.14
    p=int(input("press 1 for triangle and press 2 for circle and press 3 for rectangle :- "))
    triangle=(h*b)/2
    circle=pi*r*r
    rectangle=l*b
    if p==1:
    print("Area of triangle ",triangle)

    if p==2:
    print("Area of circle ",circle)

    if p==3:
    print("Area of rectangle ",rectangle)

    ردحذف
  24. #SHREYA SINGH
    #WAP to Reverse Five Digit Number?

    num=12345
    print("Given 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
    rev=a*10000+b*1000+c*100+d*10+e*1
    print("Reverse of the Number is:",rev)

    ردحذف
  25. Addition of complex numbers without using complex()?
    a=int(input("enter real number:-"))
    bj=int(input("enter imaginary number:-"))
    c=int(input("enter real number:-"))
    dj=int(input("enter imaginary number:-"))
    r=a+c
    r1=bj+dj
    print("{0}+{1}j".format(a,bj))
    print("{0}+{1}j".format(c,dj))
    print("{0}+{1}j".format(r,r1))

    ردحذف
  26. h,b=int(input("enter heigth of triangle:-")),int(input("enter base of triangle:-"))
    area=(h*b)/2
    print("area of triangle is:-",area)
    l,w=int(input("enter length of rectangle:-")),int(input("enter width of ractangle:-"))
    area1=l*w
    print("area of ractangle is:-",area1)

    ردحذف
  27. #reverse number using while loop
    num=int(input("enter any number:="))
    print("reverse num is:-")
    while num>0:
    print(num%10)
    num=num//10

    ردحذف
  28. # reverse 5 digits number without while loop
    mun=int(input("enter any number:-"))
    a=mun%10
    mun=mun//10
    b=mun%10
    mun=mun//10
    c=mun%10
    mun=mun//10
    d=mun%10
    mun=mun//10
    e=mun%10
    mun=mun//10
    print(a,b,c,d,e)

    ردحذف
  29. #Area of Tringle
    b=10
    h=20
    Area=(b*h)/
    /2
    print(Area)

    ردحذف
  30. #Adding complex number using complex number

    A=2+4J
    B=4+5J
    c=A+B
    print(A)
    print(B)
    print("addition of complex number", c)
    print(c)

    ردحذف
  31. sonam singh

    a=10
    >>> b=20
    >>> area=(a*b)//2
    >>> print(area)

    ردحذف
  32. sonam singh
    a=10
    >>> b=20
    >>> area=(a*b)//2
    >>> print(area)

    ردحذف
  33. SONAM SINGH
    >>> a=5
    >>> print(a*a)
    25
    >>> print(a*a*a)
    125
    >>>

    ردحذف
  34. Area of Traingle

    B=int (input("enter the first no ;"))
    H=int (input("enter the second no ;"))
    Area=(B*H)/2
    print(Area)

    ردحذف
  35. SONAM SINGH
    a=145
    >>> num1=a%10
    >>> a=a//10
    >>> num1=a%10
    >>> format(num1)
    '4'
    >>> b=154
    >>> num2=a%10
    >>> b=b//10
    >>> num2=b%10
    >>> format(num2)
    '5'
    >>> c=451
    >>> num3=c%10
    >>> c=c//10
    >>> num3=c%10
    >>> format(num3)
    '5'
    >>>

    ردحذف
  36. SONAM SINGH
    base=int(input("enter the base value"))
    height=int(input("enter the height value"))
    area=(base*height)//2
    print(area)

    ردحذف
  37. Addition of complex number
    #Abhishek parihar

    rn1=3
    in1=4j
    rn2=5
    in2=6j
    realnumber=(rn1+rn2)
    imaginerynumber=(in1+in2)
    print(realnumber+imaginerynumber)

    ردحذف
  38. #WAP to Calculate the Area of Triangle and Rectangle?
    #area of triangle = 1/2*b*h
    #area of circle= 3.14*r**2
    b=float(input("enter the base"))
    h=float(input("enter the hight"))
    r=float(input("enter tthe radius of circle"))

    aot=(1/2)*b*h

    aoc=3.14*r**2
    print("the area of triangle and area of circle is", aot , aoc)

    ردحذف
  39. #WAP to Reverse Five Digit Number?
    num=int(input("enter five digit no."))
    a=num%10
    num=num//10
    b=num%10
    num=num//10
    c=num%10
    num=num//10
    d=num%10
    e=num//10
    rev=a*10000+b*1000+c*100+d*10+e*1
    print("the reverse value is",rev)

    ردحذف
  40. #WAP to Calculate Addition of Complex Number?
    #6+9j,10+4j
    A=6+9j
    B=10+4j
    C=A+B
    print(A)
    print(B)
    print("the addition of complex no. is",C)

    ردحذف
  41. #WAP to Calculate Addition of Complex Number without adding complex ?
    r1=4
    i1=3
    r2=3
    i2=5
    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))

    ردحذف
  42. #WAP to Calculate the Area of Triangle and Rectangle?
    #area of triangle = 1/2*b*h
    #area of rectangle= wl
    b=float(input("enter the base"))
    h=float(input("enter the hight"))
    width=float(input("enter the width "))
    length=float(input("enter the length"))
    aot=(1/2)*b*h
    aor= width*length
    print("the area of triangle and area of rectangle is", aot , aor)

    ردحذف
  43. Q1 WAP to Reverse Five Digit Number?

    num=int(input("enter a five digit number"))
    a=num%10
    num=int(num/10)
    b=num%10
    num=int(num/10)
    c=num%10
    num=int(num/10)
    d=num%10
    num=int(num/10)
    e=num%10
    num1=a*10000+b*1000+c*100+d*10+e*1
    print("reverse number is",num1)

    Q2. WAP to Calculate Addition of Complex Number?

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

    Q3. WAP to Calculate the Area of Triangle and Rectangle and Circle?

    b = int(input("enter base"))
    h = int(input("enter height"))
    area1 = (b*h)*2
    print("area of triangle",area1)

    w = int(input("enter width"))
    h = int(input("enter height"))
    area2 = w*h
    print("area of ractangle",area2)

    r = int(input("enter radious"))
    area3 = 3.14*r*r
    print("area of circle",area3)

    ردحذف
  44. #area of Rectangle

    l=int(input("enter the length"))
    w=int(input("enter the width"))
    area=w*l
    print("the area is", area)

    ردحذف
  45. #addition of unknown complex number

    x=complex(input("enter first number"))
    y=complex(input("enter second number"))

    sum=x+y
    print("the sum of complex number is", sum)

    ردحذف
  46. #reversing of known number
    x=12345
    a=x%10
    x=int(x/10)
    b=x%10
    x=int(x/10)
    c=x%10
    x=int(x/10)
    d=x%10
    x=int(x/10)
    e=x%10
    x=(a*10000+b*1000+c*100+d*10+e*1)
    print("the reverse form is",x)

    ردحذف
  47. #reversing of unknown number

    x=int(input("enter five digit number to reverse"))
    a=x%10
    x=int(x/10)
    b=x%10
    x=int(x/10)
    c=x%10
    x=int(x/10)
    d=x%10
    x=int(x/10)
    e=x%10
    x=(a*10000+b*1000+c*100+d*10+e*1)
    print("the reverse form is",x)

    ردحذف
  48. #swapping of two unknown numbers without third variable

    x=int(input("ente first number"))
    y=int(input("enter second number"))
    x=x+y
    y=x-y
    x=x-y
    print(x,y)

    ردحذف
  49. #WAP to calculate simple interest.
    p=float(input("enter the princple amount:"))
    r=float(input("enter the rate:"))
    t=float(input("enter the time:"))
    si=(p*r*t)%100
    print("simple interest for princple amounr {0}={1}".format(p,si))

    ردحذف
  50. # Area of triangle
    h= int(input("enter height of triangle"))
    b=int (input("enter base of triangle"))
    area=(h*b)//2
    print(area)

    ردحذف
  51. #area of rectangle .
    w=int(input("enter width of rectangle"))
    l=int(input("rnter length of rectancle"))
    area=w*l
    print(area)

    ردحذف
  52. #addition of complex number.
    r1=5
    i1=2
    r2=6
    i2=4
    r=r1+r2
    i=i1+i2
    print("{0}+{1}i".format (r,i))

    ردحذف
  53. l=input("Enter Length:")
    b=input("Enter Breadth:")
    h=input("Enter Height:")
    At=(int(h)*int(b))/2
    Ar=(int(l)*int(b))
    print("Area of triange is:",At)
    print("Area of rectangle is:",Ar)

    ردحذف
  54. num=int(input("Enter no.:")) #12345
    a=num%10
    num=num//10
    a1=num%10
    num=num//10
    a2=num%10
    num=num//10
    a3=num%10
    num=num//10
    RD=(a*10000+a1*1000+a2*100+a3*10+num)
    print("Reverse Digit is:",RD)

    ردحذف
  55. a=2+3j
    b=4+5j
    Add=a+b
    print("Addition of complex number is:",Add)

    ردحذف
    الردود
    1. #Addition of a complex number with and without using complex number?
      num1=5+4j
      num2=3+7j
      num=num1+num2
      print(num)

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

      حذف
  56. #wap to calculate the area of triangle and rectangle?
    b=10
    h=40
    l=30
    area=(b*h)//2
    print("area of triangle",area)
    area=l*b
    print("area of rectangle",area)

    ردحذف

إرسال تعليق

POST Answer of Questions and ASK to Doubt

المشاركات الشائعة من هذه المدونة

Uncontrolled form input in React-JS

  Uncontrolled form input in React-JS? If we want to take input from users without any separate event handling then we can uncontrolled the data binding technique. The uncontrolled input is similar to the traditional HTML form inputs. The DOM itself handles the form data. Here, the HTML elements maintain their own state that will be updated when the input value changes. To write an uncontrolled component, you need to use a ref to get form values from the DOM. In other words, there is no need to write an event handler for every state update. You can use a ref to access the input field value of the form from the DOM. Example of Uncontrolled Form Input:- import React from "react" ; export class Info extends React . Component {     constructor ( props )     {         super ( props );         this . fun = this . fun . bind ( this ); //event method binding         this . input = React . createRef ();...

JDBC using JSP and Servlet

JDBC means Java Database Connectivity ,It is intermediates from Application to database. JDBC has different type of divers and provides to communicate from database server. JDBC contain four different type of approach to communicate with Database Type 1:- JDBC-ODBC Driver Type2:- JDBC Vendor specific Type3 :- JDBC Network Specific Type4:- JDBC Client-Server based Driver  or JAVA thin driver:- Mostly we prefer Type 4 type of Driver to communicate with database server. Step for JDBC:- 1  Create Database using MYSQL ,ORACLE ,MS-SQL or any other database 2   Create Table using database server 3   Create Form according to database table 4  Submit Form and get form data into servlet 5  write JDBC Code:-     5.1)   import package    import java.sql.*     5.2)  Add JDBC Driver according to database ide tools     5.3)  call driver in program         ...

JSP Page design using Internal CSS

  JSP is used to design the user interface of an application, CSS is used to provide set of properties. Jsp provide proper page template to create user interface of dynamic web application. We can write CSS using three different ways 1)  inline CSS:-   we will write CSS tag under HTML elements <div style="width:200px; height:100px; background-color:green;"></div> 2)  Internal CSS:-  we will write CSS under <style> block. <style type="text/css"> #abc { width:200px;  height:100px;  background-color:green; } </style> <div id="abc"></div> 3) External CSS:-  we will write CSS to create a separate file and link it into HTML Web pages. create a separate file and named it style.css #abc { width:200px;  height:100px;  background-color:green; } go into Jsp page and link style.css <link href="style.css"  type="text/css" rel="stylesheet"   /> <div id="abc"> </div> Exam...