Ad Code

✨🎆 JOIN MERN, JAVA, PYTHON, AI, DEVOPS, SALESFORCE Courses 🎆✨

Get 100% Placement Oriented Program CLICK to new more info click

History & scope of Python

History and Scope of Python

History, Scope, and Execution of Python Programming

Python is a script-based language executed directly by the Python interpreter. It is extremely easy to learn and lightweight compared to many other programming languages.

Python was originally created by Guido van Rossum to develop device driver-based applications. Today, Python has evolved into a complete ecosystem used for:

  • System Software
  • Application Software
  • Data Science & Analytics
  • Machine Learning & AI
  • Interface Programming
  • Game Development
  • IoT & Arduino-based systems
  • Automation & Testing

Python’s performance is exceptional compared to C, C++, Java, PHP, etc. It focuses on code simplicity rather than heavy structure.


🚀 How to Run Python Scripts

1️⃣ Online Mode

You can run Python without installing anything using online tools:

www.jupyter.org/try

Example: Python Program for Addition

a = 10
b = 20
c = a + b
print(c)

2️⃣ Offline Mode

Download Python from the official website:

python.org

  • Download Python 3.x installer
  • Run the installer (python-3.x.exe)
  • After installation, Python provides default IDLE editor

🧠 Python Program Execution Flow

Python Source Code 
     ↓ RUN
Python Interpreter Machine
     ↓
Machine Code
     ↓
Output

📘 Program: 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 Functions in Python

✔ Output Function: print()

print("hello")              # single statement
print("hello", "world")     # multiple statements
print("hello" + "world")    # concatenation
print("%f" % 1.2345)

✔ Input Function: input()

var = input("message")   # returns string
a = int(input("message"))

Example: Addition Program

a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
c = a + b
print(c)

📚 ASSIGNMENTS

  • WAP to calculate the Area of Triangle and Rectangle
  • WAP to Reverse a Five-Digit Number
  • WAP to Add Two Complex Numbers

✔ Solution: Reverse a Five-Digit Number

num = 78125
print("Actual number is", num)

a = num % 10
num = num // 10

b = num % 10
num = num // 10

c = num % 10
num = num // 10

d = num % 10
e = num // 10

num1 = a*10000 + b*1000 + c*100 + d*10 + e

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 Using Python Complex Numbers

num1 = 2 + 3j
num2 = 4 + 5j

num = num1 + num2

print(num1)
print(num2)
print(num)

إرسال تعليق

57 تعليقات

  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