Ad Code

✨🎆 Codex 1.0 PLACEMENT READY PROGRAM! 🎆✨

Get 75% Discount Early bird offer CLICK to JOIN CodeX 1.0 click

Python Introduction:-


<

Introduction to Python Programming

Python is a high-level, interpreted programming language. That means Python code is executed by an interpreter, which reads and runs your program line by line, without a separate manual compilation step.

In many places you will see Python described as a scripting language. Scripting languages are typically executed by an interpreter and are often used to automate tasks, build applications quickly, and glue different systems together.

Other Script-Based Languages and Technologies

Along with Python, several other popular technologies are commonly used in a script-based or interpreted way:

  • PHP
  • Ruby
  • JavaScript (JS)

On top of JavaScript, we also have powerful libraries and frameworks such as:

  • jQuery
  • Angular
  • Node.js
  • React

These are not separate languages, but tools built around JavaScript that make it easier to create modern web and server applications.

How Python Evolved

Python was originally designed as a simple and powerful language for scripting and automating tasks, including working with operating systems and system utilities.

Today, Python has grown into a complete technology platform, with a rich ecosystem of libraries and frameworks that support:

  • Application software development
  • Web development
  • Data science and machine learning
  • Automation, scripting, and much more

What Can You Build with Python?

1. Desktop Applications

Desktop applications are installed directly on your computer and work even without the internet. Examples include Notepad, MS Office, antivirus software, personal firewalls, and billing systems.

Popular Python options:

  • Tkinter — the standard GUI library that comes with Python.
  • PyQt — a powerful toolkit for building professional desktop applications.

2. Web Applications

Web applications run on servers and are accessed through a browser using the Internet or an intranet. Examples include platforms similar to YouTube or Twitter.

Popular Python web frameworks:

  • Django — a high-level web framework for rapid development.
  • Flask — a lightweight, flexible micro-framework.
  • Pyramid — a flexible framework for larger, custom web apps.

3. Mobile Applications

Python can also be used to build multi-platform mobile applications with touch-based interfaces.

Popular framework:

  • Kivy — used to build mobile and multitouch applications.

4. Data Science and Analytics

Python is one of the most popular languages for data science. It is used for:

  • Data analysis
  • Data engineering
  • Data visualization
  • Data processing and operations

Important Python libraries:

  • NumPy — numerical computing and arrays
  • Pandas — data analysis and data frames
  • SciPy — scientific computing
  • Matplotlib — data visualization and plotting

5. Machine Learning

Machine learning works closely with data science to build models that learn from data and make predictions. Python provides an easy way to implement machine learning algorithms.

Popular tool:

  • scikit-learn — a powerful library for classical machine learning algorithms.

6. IoT (Internet of Things) Applications

IoT applications connect devices like sensors, lights, and home appliances to the internet. Python is often used on small devices (like Raspberry Pi) to build:

  • Home automation systems
  • Sensor-based monitoring
  • Smart gadgets and prototypes

7. Cloud-Based Applications

Cloud means an online platform that provides common access to applications and data from anywhere, on any device. Python is well supported on all major cloud platforms:

  • AWS (Amazon Web Services)
  • Microsoft Azure
  • Google Cloud Platform

You can use Python to build and deploy scalable cloud applications, APIs, and microservices.

8. Game Development

Python can also be used for 2D game development and for learning the basics of game logic and design.

Popular library:

  • Pygame — a library used to build simple and educational games in Python.

9. Device Control and Networking

Python can interact with devices like Wi-Fi modules, Bluetooth devices, and various sensors. It is very popular for writing scripts that control or automate hardware.

10. Security, Automation, and Firewalls

Python is widely used in cybersecurity and IT automation for:

  • Writing security scripts
  • Log analysis and monitoring
  • Automating firewall rules and network tasks

Python Practice Assignments

Try these assignments to practice basic Python programming and logic:

  1. Difference between two dates (in years)
    Write a program to calculate the difference between two dates in years. The dates will be entered (or stored) in ddmmyyyy format, for example:
    12052016
    13062019
    Output should show the year difference (for example: 2019 - 2016 = 3).
  2. Sum of all digits in date of birth
    Write a program to calculate the sum of all digits in a date of birth entered in ddmmyyyy format.
  3. Feet & Inches Conversion
    Write a program to:
    • Convert feet to inches
    • Convert inches to feet
  4. Convert kilometers to meters
    Write a program to convert a value given in kilometers to meters.
  5. Convert decimal to binary
    Write a program to convert a decimal (base-10) number into its binary (base-2) representation.
  6. Salary calculation program
    Write a program to calculate the following salary components:
    • basic
    • ta (Travel Allowance)
    • da (Dearness Allowance)
    • comm (Commission)
    • emppf (Employee PF)
    • employerpf (Employer PF)
    • hra (House Rent Allowance)
    • advancesal (Advance Salary)
    • nl (number of leave days taken by employee)
    • tsal (Total Salary)
    • leave (Per-day leave deduction)
    • ctc (Cost to Company)
    • grosssal (Gross Salary after deductions)

    Use the following formulas and values:

    basic = 5000
    ta = basic * (2 / 100)
    da = basic * (5 / 100)
    comm = basic * (5 / 100)
    emppf = basic * (8.33 / 100)
    employerpf = basic * (3.67 / 100)
    hra = basic * (10 / 100)
    advancesal = 500
    nl = 3  # number of leave days
    
    tsal = basic + ta + da + comm
    leave = tsal / 30
    ctc = basic + ta + da + comm + emppf + hra
    grosssal = tsal - emppf - (nl - 1) * leave - advancesal
    
    print("Package is ", 12 * ctc)
    print("Gross salary is ", grosssal)
    print("Leave Deduction days ", nl - 1, " and amount is ", (nl - 1) * leave)
    print("PF Deduction is ", emppf)
    print("TA is ", ta, "\nDA is ", da, "\nCommission is ", comm,
          "\nHRA is ", hra, "\nAdvance Salary is ", advancesal)

These assignments will help you get comfortable with Python syntax, operators, and basic logic building.

Post a Comment

68 Comments

  1. number = 123
    rev_num = 0
    while (number > 0) :
    rev_num = (rev_num*10) + number%10
    number = (int)(number/10)
    print(rev_num)

    ReplyDelete
  2. This program should be created without loop and if use loop then use indentation

    ReplyDelete
  3. num =123
    a = num%10 #3
    num= num//10 #12
    b= num%10 #2
    c=num//10 #1
    rev = a*100+b*10+c*1
    print(rev)

    ReplyDelete
  4. What is Interpreter and script both are same?

    ReplyDelete
  5. Program of Compund Interest?

    p=1000000
    r=7.5
    t=20
    n=12
    R = r/100
    ci= p*((1+R/n)**(n*t))
    print("Total amount including interest is ",ci,"\n interest ",(ci-p))

    ReplyDelete
  6. # area of traingle

    l=int(input("enter length value=") )
    b=int(input("enter breath value="))
    area=1/2*l*b
    Print("enter length value=" , "enter breath value= , area)


    ReplyDelete
  7. #reverse number using While loop

    number=123
    rev_num=0

    while(number>0):
    rev_num=(rev_num*10)+number%10
    number=(int)(number/10)
    print(rev_num)

    ReplyDelete
  8. #compount interest program

    p=15000
    r=7.5
    t=3
    n=12

    R=r/100
    ci=p*((1+R/n)**(n*t))

    print("Total ammount including interest is ",ci,"/n interest",(ci-p))


    ReplyDelete
  9. # Difference between two date in year
    # created by Shiva
    firstdate = int("02061998") #ddmmyyyy
    lastdate = int("03072021")

    f1 = firstdate%10000
    print(f1)
    f2 = lastdate%10000
    print(f2)

    year = f2-f1

    print(year)

    ReplyDelete
  10. #Program of Compund Interest

    p=1000000
    r=7.5
    t=20
    n=12
    R = r/100
    ci= p*((1+R/n)**(n*t))
    print("Total amount including interest is ",ci,"\n interest ",(ci-p))

    ReplyDelete
  11. # area of traingle

    l=int(input("enter length value=") )
    b=int(input("enter breath value="))
    area=1/2*l*b
    Print("enter length value=" , "enter breath value= , area)

    ReplyDelete
  12. # Difference between two date in year

    firstdate = int("02061998") #ddmmyyyy
    lastdate = int("03072021")

    f1 = firstdate%10000
    print(f1)
    f2 = lastdate%10000
    print(f2)

    year = f2-f1

    print(year)

    ReplyDelete
  13. #wap find square and cube of number

    a=5
    print(a*a)
    print(a*a*a)

    ReplyDelete
  14. #swap of two number using third variable in jupyter
    a=10
    b=20
    print("before swap")
    print(a,b)
    temp=a
    a=b
    b=temp
    print("after swap")
    print(a,b)

    ReplyDelete
  15. #reverse 5 digits number without 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)

    ReplyDelete
  16. #WAP to display the middle number is a three-digit number?

    a=int(input("enter the value"))
    b=int(input("enter the second value"))
    c=a%10
    a=a//10
    c=a%10
    d=b%10
    b=b//10
    d=b%10
    print("the first mid no is",c ,"the second mid no is",d)

    ReplyDelete
  17. #WAP to calculate Square and Cube of any assigned number.
    a=int(input("enter number for square and cube"))
    square=(a*a)
    print("the assgined square is",square)
    cube=(a*a*a)
    print("the Assgined cube is",cube)

    ReplyDelete
  18. #Area of Tringle
    b=10
    h=20
    Area=(b*h)/
    /2
    print(Area)

    ReplyDelete
  19. #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)

    ReplyDelete
  20. #convert temperature from Celsius to Fahrenheit?
    '''formula --> fahrenheit = (celsius * 1.8) + 32'''

    celsius=float(input(" Temperature in Celsius : "))
    fahrenheit=(celsius*1.8)+32
    print("{0} degree Celsius is equal to {1} degree Fahrenheit".format (celsius,fahrenheit))

    ReplyDelete
  21. #calculate Simple Interest where rate and time will be constant and
    the principal will be an integer

    CONST = (2.5,4.5)
    p=450000
    si = (p*CONST[0]*CONST[1])/100
    print(si)

    ReplyDelete

  22. #Program to calculate AREA of Triangle,RECT and CIRCLE?

    CONST = (3.14,200,50)
    r = 5
    height=20
    width=300
    areaOfCircle = CONST[0]*r*r
    areaOfTriangle = (CONST[1]*height)/2
    areaOfRectangle = width*CONST[2]
    print("Area of Cirlce is",areaOfCircle)
    print("Area of Triangle is",areaOfTriangle)
    print("Area of Rectangle is ",areaOfRectangle)

    ReplyDelete
  23. #calculate the total salary of an employee where basic, ta, da, comm, pf,hra, leave will be entered by the users

    basic_salary = int(input("enter ur basic salary: "))
    ta = int(input("enter ur ta: "))
    da = int(input("enter ur da: "))
    comm = int(input("enter ur comm: "))
    pf = int(input("enter ur pf amount: "))
    num_of_leave = int(input("enter ur num of leave: "))

    leave_amount = num_of_leave*((basic_salary+ta+da+comm+pf)/30)
    net_salary =basic_salary + ta + da + comm + pf - leave_amount
    print("ur net salary=",net_salary)

    ReplyDelete
  24. #WAP to evaluate the middle number in three-digit numbers based on order?

    x = int(input("Enter 3 digit number = "))
    a = x % 100
    b = a // 10
    print("Middle number is = ",b)

    ReplyDelete
  25. #multiplication of a complex number:-
    a=2+5j
    b=4+6j
    print("a=",a)
    print("b=",b)
    c=(a*b)
    print("multiplication of a complex number:",c)

    ReplyDelete
  26. #WAP to calculate difference of two date in year.

    fstdate=int(input("enter the first date of birth in ddmmyyyy"))
    lstdate=int(input("enter last date of birth in ddmmyyyy"))
    f1=fstdate%10000
    f2=lstdate%10000
    year=(f1-f2)
    print("%d" % year)

    ReplyDelete
  27. #WAP to calculate sum of all digit in date of birth.
    num=int(input("enter dob in form of ddmmyyyy"))
    a=num%10000
    num1=num//10000
    b=num1%100
    num2=num1//100
    c=num2%10
    sum=a+b+c
    print(sum)

    ReplyDelete
  28. #WAP to Convert feet to inch and inch to feet?
    #inch==feet*12
    feet=float(input("enter the value"))
    inch=feet*12
    print("the value of inch is ",inch)

    ReplyDelete
  29. # WAP to convert km to meter?
    #1km=1000 meters
    km=float(input("enter km"))
    meter=km*1000
    print("the value in meter is ",meter)

    ReplyDelete
  30. #WAP to Convert to inch to feet .
    #feet==inch/12
    inch=float(input("enter the value of inch"))
    feet=inch/12
    print("the convertion inch to feet is ",feet)

    ReplyDelete
  31. #WAP to Convert to inch to feet .
    #feet==inch/12
    inch=float(input("enter the value of inch"))
    feet=inch/12
    print("the convertion inch to feet is ",feet)

    ReplyDelete
  32. #WAP to calculate difference of two date in year.
    firstdate=12052017
    nowdate=28092021
    f1= (firsdate%1000)
    print (f1)
    f2=(nowdate%1000)
    print (f2)
    year=f2-f1
    print(year)

    ReplyDelete
  33. #WAP to convert km to meret .
    km=int(input("enter km"))
    meter=km*1000
    print(meter)

    ReplyDelete
  34. #addition of dob of yash
    dob=10091997
    a=dob%10 #7
    dob=dob//10 #1009199
    b=dob%10 #9
    dob=dob//10 #100919
    c=dob%10 #9
    dob=dob//10 #10091
    d=dob%10 #1
    dob=dob//10 #1009
    e=dob%10 #9
    dob=dob//10 #100
    f=dob%10 #0
    dob=dob//10 #10
    g=dob%10 #0
    dob=dob//10 #1
    h=dob%10
    dob=dob//10
    print(a+b+c+d+e+f+g+h)
    #output is 36

    ReplyDelete
  35. #WAP to convert km to meret .
    km=int(input("enter km"))
    meter=km*1000
    print(meter)

    ReplyDelete
  36. #WAP to convert km to meret .
    km=int(input("enter km"))
    meter=km*1000
    print(meter)

    ReplyDelete
  37. # difference of two date in year

    pritesh=int("01111997")
    shlok=int("25111999")
    p=pritesh%10000
    s=shlok%10000
    diff=s-p
    print("Difference of two date in year is:",diff)

    ReplyDelete
  38. # sum of DOB

    p=int("12111997")
    a=p%10 #7
    p=p//10 #1211199
    b=p%10 #9
    p=p//10 #121119
    c=p%10 #9
    p=p//10 #12111
    d=p%10 #1
    p=p//10 #1211
    e=p%10 #1
    p=p//10 #121
    f=p%10 #1
    p=p//10 #12
    g=p%10 #2
    p=p//10 #1
    print("Sum of dob is ",a+b+c+d+e+f+g+p)

    ReplyDelete
  39. # conversion into km to meter
    a=float(input("Enter distance in KM:"))
    M=1000*a
    print(M)

    ReplyDelete
  40. convert decimal to binary
    a=bin(5)
    print(a)

    ReplyDelete
  41. #program to calculate difference between two dates in year
    date1 = int(input("Enter First Date in ddmmyyyy"))
    date2 = int(input("Enter Last Date in ddmmyyyy"))
    y1=date1 % 10000
    y2=date2 % 10000

    diff = y2-y1
    print("Difference between two date in year is ",diff)

    ReplyDelete
  42. #program to calculate sum of all digit in dob

    dob = int(input("Enter date of birth in ddmmyyyy"))
    a = dob%10 # 2
    dob = dob//10 # 1001199
    b = dob%10 # 9
    dob = dob//10 #100119
    c = dob%10 #9
    dob = dob//10 #10011
    d = dob%10 #1
    dob = dob//10 #1001
    e = dob%10 #1
    dob = dob//10 #100
    f = dob%10 #0
    dob = dob//10 #10
    g = dob%10 #0
    h = dob//10 #1
    s = a+b+c+d+e+f+g+h
    print(s)

    ReplyDelete
  43. 1.WAP to calculate difference of two date in year, date should be assigned on ddmmyyyy



    from datetime import date

    firstdate = int("12052016") #ddmmyyyy
    lastdate = int("13062019")

    f1 = firstdate%10000
    print(f1)
    f2 = lastdate%10000
    print(f2)
    year = f2-f1
    print(year)

    ReplyDelete
  44. 1.WAP to calculate the sum of all digits in date of birth?

    num = int(input("Enter your birth year: "))
    x = num //1000
    print(x)
    x1 = (num - x*1000)//100
    print(x1)
    x2 = (num - x*1000 - x1*100)//10
    print(x2)
    x3 = num - x*1000 - x1*100 - x2*10
    print(x3)
    x4 = x+x1+x2+x3
    print ("sum of all digits in your birth year",x4)

    ReplyDelete
  45. 3.WAP to Convert feet to inch and inch to feet?

    feet = int(input("Enter the length in feet:"))
    # convert feet to Inches
    Inch = 12 * feet;

    print("The length in Inches is", round(Inch, 2))
    Inches = int(input("Enter the value of length in Inches:"))
    # convert Inches to Feet
    Feet = Inches / 12;

    print("The length in Feet", round(Feet, 2))

    ReplyDelete
  46. 4.WAP to convert km to meter?


    km=int(input("Enter Kilo Meters:"))
    m=km*1000
    print(m)

    ReplyDelete
  47. decimal number
    number = int(input("Enter any decimal number: "))

    # print equivalent binary number
    print("Equivalent Binary Number: ", bin(number))



    decimal number
    number = int(input("Enter any decimal number: "))

    # print equivalent binary number
    print("Equivalent Binary Number: ", bin(number))





    ReplyDelete

  48. 1.WAP to calculate the sum of all digits in date of birth?

    num = int(input("Enter your birth year: "))
    x = num //1000
    print(x)
    x1 = (num - x*1000)//100
    print(x1)
    x2 = (num - x*1000 - x1*100)//10
    print(x2)
    x3 = num - x*1000 - x1*100 - x2*10
    print(x3)
    x4 = x+x1+x2+x3
    print ("sum of all digits in your birth year",x4)

    ************************************************************************************************************

    2.WAP to calculate difference of two date in year, date should be assigned on ddmmyyyy


    date1 = int(input("Enter First Date in ddmmyyyy"))
    date2 = int(input("Enter Last Date in ddmmyyyy"))
    y1=date1 % 10000
    y2=date2 % 10000

    diff = y2-y1
    print("Difference between two date in year is ",diff)



    or

    firstdate = int("02061998") #ddmmyyyy
    lastdate = int("03072021")

    f1 = firstdate%10000
    print(f1)
    f2 = lastdate%10000
    print(f2)

    year = f2-f1

    print(year)



    ****************************************************************************************************************
    3.WAP to Convert feet to inch and inch to feet?

    feet = int(input("Enter the length in feet:"))
    # convert feet to Inches
    Inch = 12 * feet;

    print("The length in Inches is", round(Inch, 2))
    Inches = int(input("Enter the value of length in Inches:"))
    # convert Inches to Feet
    Feet = Inches / 12;

    print("The length in Feet", round(Feet, 2))


    ***************************************************************************

    4.WAP to convert km to meter?


    km=int(input("Enter Kilo Meters:"))
    m=km*1000
    print(m)
    *****************************************************************************
    5.WAP to convert decimal to binary?


    decimal number
    number = int(input("Enter any decimal number: "))

    # print equivalent binary number
    print("Equivalent Binary Number: ", bin(number))


    ******************************************************************************

    WAP to calculate basic, ta, da, comm, pf, HRA, Leave, numberofleave will be entered by the users?



    print("SALARY PROGRAM")
    name= str(input("Enter name of employee:"))
    basic=float(input("Enter Basic Salary :"))
    da=float(basic*0.25)
    hra=float(basic*0.15)
    pf=float((basic+da)*0.12)
    ta=float(basic*0.075)
    netpay=float(basic+da+hra+ta)
    grosspay=float(netpay-pf)

    print("\n\n")
    print("S A L A R Y D E T A I L E D B R E A K U P ")
    print("==============================================")
    print(" NAME OF EMPLOYEE : ",name)
    print(" BASIC SALARY : ",basic)
    print(" DEARNESS ALLOW. : ",da)
    print(" HOUSE RENT ALLOW.: ",hra)
    print(" TRAVEL ALLOW. : ",ta)
    print("==============================================")
    print(" NET SALARY PAY : ",netpay)
    print(" PROVIDENT FUND : ",pf)
    print("==============================================")
    print(" GROSS PAYMENT : ",grosspay)
    print("==============================================")


    ************************************************************************************






    ReplyDelete
  49. 1.WAP to calculate the sum of all digits in date of birth?

    num = int(input("Enter your birth year: "))
    x = num //1000
    print(x)
    x1 = (num - x*1000)//100
    print(x1)
    x2 = (num - x*1000 - x1*100)//10
    print(x2)
    x3 = num - x*1000 - x1*100 - x2*10
    print(x3)
    x4 = x+x1+x2+x3
    print ("sum of all digits in your birth year",x4)

    ************************************************************************************************************

    2.WAP to calculate difference of two date in year, date should be assigned on ddmmyyyy


    date1 = int(input("Enter First Date in ddmmyyyy"))
    date2 = int(input("Enter Last Date in ddmmyyyy"))
    y1=date1 % 10000
    y2=date2 % 10000

    diff = y2-y1
    print("Difference between two date in year is ",diff)



    or

    firstdate = int("02061998") #ddmmyyyy
    lastdate = int("03072021")

    f1 = firstdate%10000
    print(f1)
    f2 = lastdate%10000
    print(f2)

    year = f2-f1

    print(year)



    ****************************************************************************************************************
    3.WAP to Convert feet to inch and inch to feet?

    feet = int(input("Enter the length in feet:"))
    # convert feet to Inches
    Inch = 12 * feet;

    print("The length in Inches is", round(Inch, 2))
    Inches = int(input("Enter the value of length in Inches:"))
    # convert Inches to Feet
    Feet = Inches / 12;

    print("The length in Feet", round(Feet, 2))


    ***************************************************************************

    4.WAP to convert km to meter?


    km=int(input("Enter Kilo Meters:"))
    m=km*1000
    print(m)
    *****************************************************************************
    5.WAP to convert decimal to binary?


    decimal number
    number = int(input("Enter any decimal number: "))

    # print equivalent binary number
    print("Equivalent Binary Number: ", bin(number))


    ******************************************************************************

    WAP to calculate basic, ta, da, comm, pf, HRA, Leave, numberofleave will be entered by the users?



    print("SALARY PROGRAM")
    name= str(input("Enter name of employee:"))
    basic=float(input("Enter Basic Salary :"))
    da=float(basic*0.25)
    hra=float(basic*0.15)
    pf=float((basic+da)*0.12)
    ta=float(basic*0.075)
    netpay=float(basic+da+hra+ta)
    grosspay=float(netpay-pf)

    print("\n\n")
    print("S A L A R Y D E T A I L E D B R E A K U P ")
    print("==============================================")
    print(" NAME OF EMPLOYEE : ",name)
    print(" BASIC SALARY : ",basic)
    print(" DEARNESS ALLOW. : ",da)
    print(" HOUSE RENT ALLOW.: ",hra)
    print(" TRAVEL ALLOW. : ",ta)
    print("==============================================")
    print(" NET SALARY PAY : ",netpay)
    print(" PROVIDENT FUND : ",pf)
    print("==============================================")
    print(" GROSS PAYMENT : ",grosspay)
    print("==============================================")


    ************************************************************************************






    ReplyDelete
  50. #shalu
    nch =int("enter the value of inch")
    feet= inch % 12
    print("the convertion inch to feet is",feet)

    ReplyDelete
  51. #shalu
    def getdifference(dt1,dt2):

    dt1=[12,5,2016]
    dt2=[13,6,2019]
    print("difference between two dates is",getdifference(dt1,dt2))

    ReplyDelete
  52. #shalu
    a=123
    print(a)
    num1=a%10
    a=int(a/10)
    num2=a%10
    num3=a//10
    res=num1*100+num2*10+num3*1
    print(res)


    #second method
    b=45678
    print(b)
    num1=b%10
    b=(b//10)
    num2=b%10
    b=(b//10)
    num3=b%10
    b=(b//10)
    num4=b%10
    b=(b//10)
    num5=b%10
    b=(b//10)
    res=num1*10000+num2*1000+num3*100+num4*10+num5*1
    print(res)

    ReplyDelete
  53. #shalu
    #sum
    num=27091995
    a=num%1000
    num=num//1000
    b=num%100
    num=num//100
    c=num%10
    sum=a+b+c
    print(a+b+c)

    ReplyDelete
  54. WAP to calculate the sum of all digits in date of birth?

    num = int(input("Enter your birth year: "))
    x = num //1000
    print(x)
    x1 = (num - x*1000)//100
    print(x1)
    x2 = (num - x*1000 - x1*100)//10
    print(x2)
    x3 = num - x*1000 - x1*100 - x2*10
    print(x3)
    x4 = x+x1+x2+x3
    print ("sum of all digits in your birth year",x4)

    ************************************************************************************************************

    ReplyDelete
    Replies
    1. wap to calculate the total salary of an employee where basic ,ta, da,comm,pf,hra,leave,advance salary will be entered by the users?

      basic=5000
      ta=basic*(2/100)
      da=basic*(5/100)
      comm=basic*(5/100)
      emppf=basic*(8.33/100)
      employerpf=basic*(3.67/100)
      hra=basic*(10/100)
      advancesal=500
      nl=3
      tsal=basic+ta+da+comm
      leave=tsal/30
      ctc=basic+ta+da+comm+emppf+hra
      grossal=tsal-emppf-(nl-1)*leave-advancesal
      print("package is",12*ctc)
      print("gross salary is",grossal)
      print("leave deduction days,nl-1" and "amount is",(nl-1)*leave)
      print("pf diduction is",emppf)
      print("ta is",ta,"/n da is" ,da,"/n comm is",comm,"/n hra is",hra,"/n advance salary is",advancesal)

      Delete
  55. #Difference of two date in year?

    firstdate=int(input("enter first dob in ddmmyyyy"))
    seconddate=int(input("enter second dob in ddmmyyyy"))
    f1=firstdate%10000
    print(f1)
    f2=seconddate%10000
    print(f2)
    year=f2-f1
    print(year)

    ReplyDelete
  56. #sum of all digits in dob
    num = int(input("enter dob in from of ddmmyyyy"))
    r1=num%10000
    num1=num//10000
    print(r1 ,num1)
    r2=num1%100
    num2=num1//100
    print(r2,num2)
    r3=num2%10
    print(r3)
    sum = r1+r2+r3
    print(sum)

    ReplyDelete
  57. #convert inch to feet
    inch = float(input("enter a value "))
    feet = inch//12
    print(feet)

    ReplyDelete
  58. #convert feet to inch?
    feet=float(input("enter the value"))
    inch=feet*12
    print(inch)

    ReplyDelete
  59. #Decimal to binary?
    num=12
    s=""
    a=num%2#0
    s=s+str(a)
    num=num//2#6
    a=num%2#0
    s=s+str(a)
    num=num//2#3
    a=num%2#1
    s=s+str(a)
    num=num//2#1
    a=num%2#1
    s=s+str(a)
    print(s)

    ReplyDelete
  60. #reverse a nos
    num=123
    a=num%10
    b=num//10
    c=b//10
    d=b%10
    print(a*100+d*10+c*1)

    ReplyDelete
  61. dn=int(input("Enter any no"))
    rem=0
    bn=0
    place=1
    while(dn!=0):
    rem=dn%2
    bn=bn+(rem*place)
    place=place*10
    dn=dn//2

    print(bn)

    ReplyDelete

  62. up=float(input("enter price")) #unit price
    cons=float(input("enter consumption")) #consumption
    load=float(input("enter extra load unit"))

    bill=up*cons
    print("Total bill without load=",bill)
    bill2=2*up*load
    print("extra load bill=",bill2)
    bill3=up*cons+2*(up*load)
    print("Total bill with extra load=",bill)

    ReplyDelete
  63. This comment has been removed by the author.

    ReplyDelete
  64. firstdate = int(input("enter firstdate"))
    lastdate = int(input("enter lastdate"))
    a1= firstdate%10000
    a2 = lastdate%10000
    year=a2-a1
    print(year)

    ReplyDelete
  65. This comment has been removed by the author.

    ReplyDelete
  66. This comment has been removed by the author.

    ReplyDelete
  67. #WAP to calculate the sum of all digits in date of birth?
    dob=12012001
    a=dob%10 #1
    dob=dob//10 #1201200
    b=dob%10 #0
    dob=dob//10 #120120
    c=dob%10 #0
    dob=dob//10 #12012
    d=dob%10 #2
    dob=dob//10 #1201
    e=dob%10 #1
    dob=dob//10 #120
    f=dob%10 #0
    dob=dob//10 #12
    g=dob%10 #2
    dob=dob//10 #1
    h=dob%10
    dob=dob//10
    print(a+b+c+d+e+f+g+h)

    ReplyDelete

POST Answer of Questions and ASK to Doubt