❌

Reading view

There are new articles available, click to refresh the page.

First Python Program

while "True":

    print ("CALCULATOR")
    print ("Select Operation:")
    print ("1. Add")
    print ("2. Subtract")
    print ("3. Multiplication")
    print ("4. Division")
    print ("5. Modulus")
    print ("6. Exponentiate")

    choice = input("Enter Choice (1/2/3/4/5/6/7): ")

    if choice == "7":
       print ("Thank you for using calculator")

    elif choice < "7":

         num1 = float(input("Enter First Number:"))
         num2 = float(input("Enter Second Number:"))

    elif choice > "7":
         print ("Invalid Choice")

    # Addition

    if choice == "1":
       result = num1 + num2
       print ("result is: ", result)

    # Subtraction

    elif choice == "2":

       result = num1 - num2
       print ("result is: ", result)

    #Multiplication

    elif choice == "3":
       result = num1 * num2
       print ("result is: ", result)

    # Division


    elif choice == "4":
       result = num1 / num2
       print ("result is: ", result)
    # Remainder

    elif choice == "5":
       result = num1 % num2
       print ("result is: ", result)


    elif choice == "6":
       result = num1 ** num2
       print ("result is: ", result)

Path to Python

Attended the class conducted by Kaniyam Foundation.

Nice and simple speech. clear path forward. I have attempted to learn python many times. but no progress after learning all data types, conditions etc.

Hope this time the journey will continue.

MK

❌