Python Exercise 2 - Faulty Calculator | Python Tutorials For Absolute Beginners In Hindi #15

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • ►Source Code + Text Tutorial - www.codewithha...
    ►Full Python tutorials for absolute beginners (Hindi) playlist - • Python Tutorials For A...
    ►Click here to subscribe - / @codewithharry
    Best Hindi Videos For Learning Programming:
    ►Learn Python In One Video - • Learn Python In Hindi ...
    ►Learn JavaScript in One Video - • JavaScript Tutorial
    ►Learn PHP In One Video - • Learn Php In One Video...
    ►Machine Learning Using Python - • Machine Learning Tutor...
    ►Creating & Hosting A Website (Tech Blog) Using Python - • [Hindi] Web Developmen...
    ►Advanced Python Tutorials - • Intermediate/Advanced ...
    ►Object Oriented Programming In Python - • Object Oriented Progra...
    ►Python Data Science and Big Data Tutorials - • Python Data Science an...
    Follow Me On Social Media
    ►Website (created using Flask) - www.codewithha...
    ►Facebook - / codewithharry
    ►Instagram - / codewithharry
    ►Personal Facebook A/c - / geekyharis
    Twitter - / haris_is_here

Комментарии • 3,9 тыс.

  • @aarushikumar9
    @aarushikumar9 2 года назад +34

    Hello Harry, thanks for the exercise! It was fun working on it. Here's the code:
    n1=int(input("Enter your first number"))
    n2=int(input("Enter your second number"))
    opp=input("Choose operator (+ - * /)")
    if opp=='+':
    if n1==56 and n2==9:
    print('77')
    else:
    print(n1+n2)
    elif opp=='-':
    print(n1-n2)
    elif opp=='*':
    if n1==45 and n2==3:
    print('555')
    else:
    print(n1*n2)
    elif opp=='/':
    if n1==56 and n2==6:
    print('4')
    else:
    print(n1/n2)

  • @rahulranjaniit-r4915
    @rahulranjaniit-r4915 Год назад +37

    Pretty late to answer this but here we go!
    # Design a calculator which can input 2 numbers and perform an operation according to the user.
    # There must be a fault in the calculator. The fault must be, if the operation performed is 45*3(555), 56+9(77), 56/6=4
    # the answer must be given accordingly, as per the brackets corresponding.
    print("Welcome to the best calculator you will ever find for your math test!")
    a=float(input("Enter your first number:"))
    b=float(input("Enter your second number:"))
    op=input("Enter the operation you want to perform (+,-,*,/):")
    if (a,b)==(45,3) and op=="*":
    print("The answer is:555")
    elif (a,b)==(56,9) and op=="+":
    print("The answer is:77")
    elif (a,b)==(56,6) and op=="/":
    print("The answer is:4")
    else:
    if op=="+":
    print("The answer is:",a+b)
    elif op=="-":
    print("The answer is:",a-b)
    elif op=="*":
    print("The answer is:",a*b)
    elif op == "/":
    print("The answer is:",a/b)
    else:
    print("Enter a valid operation.")
    #Was preparing for entrances. So didn't consider programming after 10th boards. Feels great to code again!

    • @VenkiTotad
      @VenkiTotad Год назад +2

      nice bo

    • @VISHWESHWAR123
      @VISHWESHWAR123 Год назад +1

      If we need to incorporate say 100 faults then you need to put 100 ifelse statements... Better to use dictionaries for defining the faults.

    • @TheKing-ms5gi
      @TheKing-ms5gi Год назад +2

      bro if we enter 9 in a and 56 in b then it will give correct ans . so it is not the best

    • @dezabo2906
      @dezabo2906 8 месяцев назад

      Wrong because your numbers are concrating use int function in your numbers to get correct answer

    • @dezabo2906
      @dezabo2906 8 месяцев назад

      ​@@VISHWESHWAR123how meko sikhado kaise 😐

  • @ashikajain7
    @ashikajain7 9 месяцев назад +2

    a = int(input('enter your first no.: '))
    b= int(input('enter your second number: '))
    c = a+b
    d = a*b
    e = a/b
    if a == (56 or 9) and b==(9 or 56):
    print(77)
    else:
    print(c)
    if a ==(45 or 3) and b == (3 or 45):
    print(555)
    else:
    print(d)
    if a == 56 and b == 6:
    print(4)
    else:
    print(e)
    Thankyou for making it easy for us

  • @AmitGupta-io1br
    @AmitGupta-io1br 4 года назад +185

    #Neat and clean code , i hope you will like it
    # Faulty calculator
    operator = input("Enter operator:")
    val1 = int(input("Enter first operand = "))
    val2 = int(input("Enter second operand = "))
    if operator == "+":
    if val1 == 56 and val2 == 9:
    print("77")
    else:
    print("Sum is:",val1 + val2)
    if operator == "-":
    print("Substract is:",val1-val2)
    if operator == "*":
    if val1 == 45 and val2 == 3:
    print("555")
    else:
    print("Multiply is :",val1*val2)
    if operator == "/":
    if val1 ==56 and val2 == 6:
    print("4")
    else:
    print("Divide is:",float(val1/val2))

    • @p_iconic_
      @p_iconic_ 4 года назад +6

      great job !

    • @Singularity-0-1
      @Singularity-0-1 4 года назад +13

      try elif insted of if in selecting operator

    • @siddharthmore7448
      @siddharthmore7448 4 года назад +9

      bro if he enters 9 in place of 56 (val1 value in val2 ineach case) your program will give him right output

    • @raviugrah5429
      @raviugrah5429 4 года назад +4

      Tera answer hi nhi aa rha....

    • @darshanpatil6863
      @darshanpatil6863 4 года назад

      Sahi he..bas last me ek aur else lagake pure code ko khatam kardo Bhai .....

  • @r.k.rajoria1172
    @r.k.rajoria1172 3 года назад +35

    Nice exercise, it triggers the methods to add some exclusions behaviors in thousands or millions normal cases.
    Truly you are a wonderful tricky programmer.

  • @flow-codm
    @flow-codm Год назад +1

    #thank you harry bhai for teaching us
    print("type :- ADD","MULTIPLY","DIVIDE","MINUS" "
    to perform these operations")
    e = input()
    print("enter your 1st number")
    x = int(input())
    print("enter your 2nd number")
    y = int(input())
    print("your answer is")
    if e=="MULTIPLY" :
    if x==45 and y==3:
    print("555")
    else:
    print(x*y)
    elif e=="ADD" :
    if x==56 and y==7 :
    print("77")
    else:
    print(x+y)
    elif e=="DIVIDE" :
    if x==56 and y==6:
    print("4")
    else:
    print(x/y)
    elif e=="MINUS":
    print(x-y)
    else :
    print("INVALID OPERATION")

  • @princeagnihotri3488
    @princeagnihotri3488 5 лет назад +66

    faulty_calc_var = {"56*5": "540", "45+19": "61", "56-18": "31"}
    num1 = input("Enter the 1st number :")
    print("Which operation you want to perform :")
    operation = input()
    num2 = input("Enter the second number :")
    string = num1+operation+num2
    if string in faulty_calc_var:
    print(faulty_calc_var[string])
    elif operation == "+":
    print(int(num1)+int(num2))
    elif operation == "*":
    print(input(num1)*input(num2))
    elif operation == "-":
    print(int(num1)-int(num2))
    elif operation == "/":
    print(int(num1)/int(num2))

    • @aniketsaharan692
      @aniketsaharan692 5 лет назад +6

      bro I literally made the same program but just missed one line
      "string = num1 +op + num2"
      this was the only line I was missing
      thnx to ur cmnt...I have finally done it

    • @rahulkushwah2782
      @rahulkushwah2782 2 года назад +4

      but is will give right answer if i use 5*56 instead of 56*5

    • @usman3c
      @usman3c 2 года назад +3

      @@rahulkushwah2782 bro you can use 5*56 again in dictionary and give wrong answer😀

    • @mamun1299
      @mamun1299 2 года назад

      #falty calculator
      operator = input("Enter operator :")
      firstNum = input("Enter FirstNum :")
      secondNum = input("Enter SecondNum :")
      FaultyDict={"45*3":"555", "56+9":"77","56/6":"4"}
      expression = firstNum+operator+secondNum
      if operator=="+" or operator=="*":
      reverse = secondNum+operator+firstNum
      else:
      reverse = expression
      if expression in FaultyDict.keys():
      print (FaultyDict[expression])
      pass
      elif reverse in FaultyDict.keys():
      print (FaultyDict[reverse])
      pass
      else:
      print(eval(firstNum+operator+secondNum))

  • @RohanDasRD
    @RohanDasRD 5 лет назад +88

    Bhai Kya Excercise de diya..! bahar Hun Phir Bhi Maine Excercise book nikal ke code likhne laga!....Hope Calculator Faulty (Kam Karne Wala Ho jaye)

  • @ASHISHGUPTA94
    @ASHISHGUPTA94 Год назад +1

    I think it is very late to comment on this video, but being a novice in coding, it gave me immense satisfaction and confidence when i solved this faulty calculator exercise. Here is the my solution code :
    op = input("Enter operator: ")
    a = int(input("Enter your first no: "))
    b = int(input("Enter your second no: "))
    if op=="+":
    if a==56 and b ==9:
    print("56+9=77")
    else:
    print(a,"+",b,"=",a+b)
    elif op=="-":
    print(a,"-",b,"=",a-b)
    elif op=="*":
    if a==45 and b ==3:
    print("45*3=555")
    else:
    print(a,"*",b,"=",a*b)
    else:
    if a==56 and b ==6:
    print("56/6=4")
    else:
    print(a,"/",b,"=",a/b)

    • @himesh5869
      @himesh5869 Год назад +1

      not late to learn. Good code man.

    • @ASHISHGUPTA94
      @ASHISHGUPTA94 Год назад +1

      @@himesh5869 Thanks bro.

  • @vishwaskumar1528
    @vishwaskumar1528 3 года назад +7

    Thank you harry bhai for making this python course
    var1=int(input("Enter the first no. for multiplication:"))
    var2=int(input("Enter the second no. for multiplication:"))
    if var1*var2==45*3:
    print("Your result is 555")
    else :
    print("Your result is",var1*var2)
    var4=int(input("Enter the first no.for addition:"))
    var5=int(input("Enter the second no. for addition:"))
    if var4+var5==56+9:
    print("Your result is 77")
    else:
    print("Your result is ",var4+var5)
    var7=int(input("Enter the first no. for division:"))
    var8=int(input("Enter the second no. for division:"))
    if var7/var8==56/6:
    print("Your result is 4")
    else:
    print("Your result is",var7/var8)

  • @Yash.the.seeker
    @Yash.the.seeker 4 года назад +6

    i created it broo....
    ope=input("enter the operation")
    a=int(input("enter first number"))
    b=int(input("enter the second number"))
    if ope=="*" and a==56 and b==3:
    print(555)
    elif ope=="+" and a==56 and b==9:
    print(77)
    elif ope=="/" and a==56 and b==6:
    print(4)
    elif ope=="*":
    print(a,"*",b,"=",a*b)
    elif ope=="+":
    print(a,"+",b,"=",a+b)
    elif ope=="-":
    print(a,"-",b,"=",a-b)
    elif ope=="/":
    print(a,"/",b,"=",a/b)
    else:
    print("abe chutiye operations matlab +-*/")

  • @parthsarvaiya8135
    @parthsarvaiya8135 2 года назад

    # FAULTY CALCULATOR
    n1 = int(input("Enter 1st number: "))
    n2 = int(input("Enter 2nd number: "))
    op = input("Enter the operation you want to perform: ")
    if op == '+':
    if n1 == 10 and n2 == 20:
    print('35')
    else:
    print(n1 + n2)
    elif op == '-':
    print(n1 - n2)
    elif op == '*':
    if n1 == 10 and n2 == 20:
    print('300')
    else:
    print(n1 * n2)
    elif op == '/':
    if n1 == 20 and n2 == 10:
    print('3')
    else:
    print(n1 / n2)
    #THANKS SO MUCH HARRY FOR THIS PLAYLIST ITS REALLY HELPING ME & GREAT CONTENT

  • @ashwinikumar6476
    @ashwinikumar6476 4 года назад +25

    Sorry for joining late, but I'll say this tutorial is helping me a lot. #Thanks Harry bhaiya.

  • @madhurnaredi6814
    @madhurnaredi6814 5 лет назад +15

    Hi harry, thanks for uploading these videos. I have a suggestion for you. I struggle all the time applying my programming knowledge after learning it practically. Can you give some small project to us after certain lectures so that we can develop our programming skill?

  • @soulkingff5778
    @soulkingff5778 2 года назад +2

    print("enter the first number")
    n1 = int(input())
    print("enter the second number")
    n2 = int(input())
    if n1 == 45 and n2 == 3:
    print("the multiple is ",555)
    if n1 == 56 and n2 == 9:
    print("the sum is", 77)
    if n1 == 56 and n2 == 6:
    print("the division is ",4)
    else:
    print("the sum of the numbers is",int(n1)+int(n2))
    print("the multiple is ",int(n1)*int(n2))
    print("the division is",int(n1)/int(n2))
    print("the subtraction is",int(n1)-int(n2))

  • @apoorvshrivastava3544
    @apoorvshrivastava3544 5 лет назад +18

    phla vdo dkha h esa jis par ek bhi dislike nai h harry bhai ka kamaal .

    • @bajirao696
      @bajirao696 3 года назад +6

      Ab jakr 39 dislike huye hai, ye wo hai jo pythan sikhane ke paise le rhe hai😅😂

  • @aamanbhowmick6358
    @aamanbhowmick6358 3 года назад +12

    M a bit late, but love your channel, I'm in my first year now so started just now
    love your exercises,
    # Faulty Calculator
    print("Enter your first number")
    n1 = input()
    print("Enter the function you want to perform. eg: +, -, *, /")
    n2 = [input()]
    print("Enter your second number")
    n3 = input()
    print("Answer:")
    if "56" in n1 and "+" in n2 and "9" in n3:
    print("56 + 9 = 77")
    elif "45" in n1 and "*" in n2 and "3" in n3:
    print("45 * 3 = 555")
    elif "56" in n1 and "/" in n2 and "6" in n3:
    print("56 / 6 = 4")
    elif "+" in n2:
    print(n1, "+", n3, "=", int(n1)+int(n3))
    elif "-" in n2:
    print(n1, "-", n3, "=", int(n1)-int(n3))
    elif "*" in n2:
    print(n1, "*", n3, "=", int(n1)*int(n3))
    elif "/" in n2:
    print(n1, "/", n3, "=", int(n1)/int(n3))
    else:
    print("ERROR")

    • @PramodSingh-kc1ne
      @PramodSingh-kc1ne 3 года назад

      My code is exactly same as this except the variables for input()

    • @kartiksharma491
      @kartiksharma491 3 года назад

      Gud bro💯

    • @cyberninja8994
      @cyberninja8994 3 года назад +2

      if i do 9+56
      it will show the right answer 🤣

    • @hardin8557
      @hardin8557 2 года назад

      @@cyberninja8994 pir to tum
      havy driver ho bahi

  • @nabanita5356
    @nabanita5356 2 года назад

    operator=input("Enter operator")
    num1=int(input("Enter your first number:"))
    num2=int(input("Enter your second number"))
    if operator== "*":
    if num1 == 45 or num2 == 3:
    print("77")
    else:
    print("multiple is",num1*num2)
    if operator== "+":
    if num1 == 56 or num2 == 9:
    print("555")
    else:
    print("sum is",num1+num2)
    if operator== "-":
    print("subtraction is",num1-num2)
    if operator== "/":
    if num1 == 56 or num2 == 6:
    print("4")
    else:
    print("division is",num1/num2)
    thank you Harry ;))

  • @vincyjoseph7652
    @vincyjoseph7652 4 года назад +24

    Thank you so much fo your efforts in this tutorial... 🙏

  • @mailtodanish
    @mailtodanish 5 лет назад +54

    operator = input("Enter operator :")
    firstNum = input("Enter FirstNum :")
    secondNum = input("Enter SecondNum :")
    FaultyDict={"45*3":"555", "56+9":"77","56/6":"4"}
    expression = firstNum+operator+secondNum
    reverse = secondNum+operator+firstNum
    if expression in FaultyDict.keys():
    print (FaultyDict[expression])
    pass
    elif reverse in FaultyDict.keys():
    print (FaultyDict[reverse])
    pass
    else:
    print(eval(firstNum+operator+secondNum))

    • @ishantgurjar8769
      @ishantgurjar8769 2 года назад +1

      jh

    • @akhileshlal2816
      @akhileshlal2816 2 года назад +1

      I was in little bit confusion. Thank u you cleared it

    • @lubanmahfuz8271
      @lubanmahfuz8271 2 года назад +2

      i learn about eval function from you ! thanks a lot bro

    • @shubhmali770
      @shubhmali770 2 года назад +2

      Lern a lot from your program👍

    • @shivamupadhyay2278
      @shivamupadhyay2278 2 года назад +1

      I only learned that eval is used with input to identify datatypes never thought it could evaluate operations too.

  • @amandeepkaur-jl6tr
    @amandeepkaur-jl6tr 2 года назад +1

    i have just started learning python . this is my first ever language to learn. here is my code:-
    d1={"45*3":"555", "56+9":"67", "56/6":"4"}
    print("Type your problem")
    v1=input()
    if v1 in d1:
    print(d1.get(v1))
    else:
    print(eval(v1))
    thanku Harry love love love.

    • @user-jp3dp9gf9m
      @user-jp3dp9gf9m 6 месяцев назад

      but bro we have to take input of first number , second number and opretor

    • @user-jp3dp9gf9m
      @user-jp3dp9gf9m 6 месяцев назад

      no1 = int(input("enter your first number - "))
      opreotr = input("enter your opretor - ")
      no2 = int(input("enter you rsecond number - "))
      if opreotr== "+" :
      print(no1 + no2 )
      elif opreotr== "-" :
      print(no1 - no2 )
      elif opreotr== "/" :
      print(no1 / no2 )
      elif opreotr== "*" :
      print(no1 * no2 )
      if no1 == 43 or 3 and no2 == 3 or 43 and opreotr == "*" :
      print(555)
      elif no1 == 56 or 9 and no2 == 9 or 56 and opreotr == "+" :
      print(77)
      elif no1 == 56 or 6 and no2 == 6 or 56 and opreotr == "/" :
      print(4)

  • @techieroy6177
    @techieroy6177 5 лет назад +111

    def calculetor():
    print("
    Wellcome to Calc: This is Developed by Subham Roy")
    operation = input('''
    Please type in the math operation you would like to complete:
    + for addition
    - for subtraction
    * for multiplication
    / for division
    ** for power
    % for modulo

    Enter Your Choise:
    ''')
    num1 = int(input("Enter first Number: "))
    num2 = int(input("Enter second Number: "))
    if operation == '+':
    if num1 == 56:
    print("56 + 9 = 77")
    else:
    print(f"{num1} + {num2} = {num1 + num2}")
    elif operation == '-':
    print(f"{num1} - {num2} = {num1 - num2}")
    elif operation == '*':
    if num1 == 45:
    print("45 * 3 = 555")
    else:
    print(f"{num1} * {num2} = {num1 * num2}")
    elif operation == '/':
    if num1 == 56:
    print("56/6 = 4")
    else:
    print(f"{num1} / {num2} = {num1 / num2}")
    elif operation == '**':
    print(f"{num1} ** {num2} = {num1 ** num2}")
    elif operation == '%':
    print(f"{num1} % {num2} = {num1 % num2}")
    else:
    print("You Press a Invalid Key")
    again()
    def again():
    cal_again = input('''
    Do you want to calculate again?
    Please type y for YES or n for NO.
    ''')
    if cal_again == 'y':
    calculetor()
    elif cal_again == 'n':
    print("See You Later")
    else:
    again()
    calculetor()
    #Subham Roy
    #please check your fb page's inbox

    • @krishnamahra2195
      @krishnamahra2195 5 лет назад +3

      @Techie Roy tumhare code me gadbadi h
      56+4 = 56+9= 77 aa raha h check karo

    • @ankushjakkulwar8136
      @ankushjakkulwar8136 5 лет назад +2

      Bhai and function use karana chahiye tha

    • @imshan9127
      @imshan9127 4 года назад +2

      @@krishnamahra2195 you are right. Use "AND" function to avoid this error. example:
      if operation == '+':
      if num1 == 56 and num2 == 9:
      print("56 + 9 = 77")

    • @princeshriwastav1877
      @princeshriwastav1877 4 года назад +1

      This is a copy code of this video ruclips.net/video/T3Z4w0jjx2Y/видео.html check out this.. Harry sir and also check the date of this video..

    • @rajat_00
      @rajat_00 4 года назад

      @@krishnamahra2195 bhai kyu k he has defined only the first variable... i.e. sirf 56 value assign ki hai. Which means, whichever value you choose, if your first number is 56, the n you'll always get 56 + that number = 77 only

  • @PrinceKumar-kr5ig
    @PrinceKumar-kr5ig 5 лет назад +52

    Keep going man, I have my resolution of 2019 to be awesome in Python and I know you can help me a lot.

    • @harrybhai7175
      @harrybhai7175 3 года назад +2

      Bhai is python code me koi mistake hai to batao :-
      print('Enter your phone number')
      ph=int(input())
      If ph==[0:9]:
      print ('Phone Number valid')
      elif ph==[0:8] and ph==[0:11]:
      print('Phone Number is Invalid')
      else:
      print('Phone Number is Invalid')

    • @divyanshtiwari85
      @divyanshtiwari85 3 года назад

      @@harrybhai7175 [0:10] leekh ho jayega... 0:9 ki place par

    • @harrybhai7175
      @harrybhai7175 3 года назад

      @@divyanshtiwari85 Bhai mera 3rd line (ph)error kyu Bata raha hai please help me

    • @suchitrayadav5237
      @suchitrayadav5237 3 года назад +1

      @@harrybhai7175 """The problem is maybe u are assigning a variable directly to a range while range() function can be used,se below:"""
      print("enter your phone no")
      ph=int(input())
      if ph==range(0,9):
      print('phone no valid')
      elif ph==range(0,8) and ph==(0,11):
      print('phone no is invalid')
      else:
      print("phone no is invalid")
      """There is a simple way of making it work without range envolvement is by using len() function,se below:"""
      print("enter your phone no")
      ph=input()
      if len(ph)==9:
      print('phone no valid')
      elif len(ph)==8 and len(ph)==11:
      print('phone no is invalid')
      else:
      print("phone no is invalid")
      """Quite easy right , remember that functions give u extreme efficiency , so use them """

    • @ashishnegi3848
      @ashishnegi3848 3 года назад +1

      @@harrybhai7175
      bhai integer mn slicing kaam nhi krti h...aap neeche wala code try kro jo mene likha h:-
      ph=input()
      if len(ph)==10 and int(ph[0]) in (6,7,8,9):
      print("valid number")
      else:
      print("phone number is invalid")

  • @muhammadkashifkhattak7541
    @muhammadkashifkhattak7541 2 года назад +5

    #this is simplest solution i guess and works for all the examples.
    print("input first number")
    a = int(input())
    print("input second number")
    b = int(input())
    print("enter operator")
    opr = input()
    if a == 3 and b == 4 and opr == "+":
    print("10") #wrong asnwer
    elif a == 5 and b == 6 and opr == "/":
    print("20") #wring answer
    elif a == 5 and b == 6 and opr == "*":
    print("25") #wrong asnwer
    elif opr == "*":
    print("the answer is", a * b)
    elif opr == "/":
    print("the answer is", a/b)
    elif opr == "-":
    print("the asnwer is ", a-b)
    elif opr == "+":
    print("the answer is ", a+b)

  • @aprameyamandal4346
    @aprameyamandal4346 3 года назад +4

    Harry bhai thora bara program hai but apne ab tak jojo sikhaya uske ander se hai.......
    a = int(input("Enter the first number: "))
    b = int(input("Enter the second number: "))
    c = input("Enter the operation you want to perform, (Enter only +, -, *, / --or the program will throw you error): ")
    a_list = [45, 56]
    b_list = [3, 9, 6]
    if a not in a_list:
    if b not in b_list:
    if c == '+':
    result = a + b
    print("The result is: ", result)
    elif c == '-':
    result = a - b
    print("The result is: ", result)
    elif c == '*':
    result = a * b
    print("The result is: ", result)
    else:
    result = a / b
    print("The result is: ", result)
    elif a == 45:
    if b == 3:
    if c == '*':
    print("The result is: ", 455)
    elif a == 56:
    if b == 9:
    if c == '+':
    print("The result is: ", 77)
    elif a == 56:
    if b == 6:
    if c == '/':
    print("The result is: ", 4)

  • @Ruthlestopper
    @Ruthlestopper 3 года назад +4

    Did it in less than 5 minutes hehe 😁
    a = int(input("first num"))
    b = int(input("second num"))
    if a == 56 and b ==9:
    add = 77
    else:
    add = a + b
    if a == 45 and b ==3:
    multiply = 555
    else:
    multiply = a*b
    if a ==56 and b ==6:
    divide = 4
    else:
    divide = a/b
    print(add)
    print(multiply)
    print(divide)
    Thank your for all these tutorials.

  • @TanaySinghai369
    @TanaySinghai369 Год назад +1

    print("Welcome to the calculator made by 10ay")
    print("1. Addition
    2. Substraction
    3. Multiplication
    4. Division")
    op=int(input("Please Select number of operation which you want to perform:"))
    listop = [1,2,3,4]
    if op in listop:
    no_1=int(input("Enter Your 1. No.:"))
    no_2=int(input("Enter Your 2. No.:"))
    if op==1:
    if (no_1,no_2)==(56,9):
    print(77)
    else:
    print(no_1+no_2)
    elif op==2:
    print(no_1-no_2)
    elif op==3:
    if (no_1,no_2)==(43,3):
    print(555)
    else:
    print(no_1*no_2)
    elif op==4:
    if (no_1,no_2)==(56,6):
    print(4)
    else:
    print(no_1/no_2)
    else:
    print("Please Enter Valid Number")

  • @testingapplications1434
    @testingapplications1434 2 года назад +15

    # code with Harry : Solution -4
    print("Enter first Number")
    var_1 = int(input())
    print("Enter second Number")
    var_2 = int(input())
    print("Enter Operator
    + for Addition
    - for subtraction
    * for multiplication
    / for division")
    operator = input()
    if operator == "+":
    if int(var_1) == 56 and int(var_2) == 9:
    result = 77
    else:
    result = int(var_1 + var_2)
    print("Result = ", result)
    elif operator == "-":
    result = int(var_1-var_2)
    print("Result = ", result)
    elif operator == "*":
    if int(var_1) == 45 and int(var_2) == 3:
    result = 555
    else:
    result = int(var_1 * var_2)
    print("Result = ", result)
    elif operator == "/":
    if int(var_1) == 56 and int(var_2) == 6:
    result = 4
    else:
    result = int(var_1 / var_2)
    print("Result = ", result)
    else:
    print("Invalid Operator entered")

    • @rafe920
      @rafe920 Год назад

      Very nice

    • @rafe920
      @rafe920 Год назад +1

      @FrosT welcome bro

  • @GauravSingh-mn6tk
    @GauravSingh-mn6tk 4 года назад +11

    print("This is a basic calculator designed by Gaurav
    Please Enter Your mode of operation as per the below instructions:
    + for addition
    - for substraction
    * for multiplication
    / for division
    ** for power")
    while(True) :
    a=input("Enter your mode of operation : ")
    b=int(input("Enter your first number : "))
    c=int(input("Enter your second number : "))
    if a=="+":
    if b==56 and c==9 :
    print("The addition is : 77")
    else :
    print("The addition is :", b+c)
    if a=="-":
    print("The substration is : ", b - c)
    if a == "*":
    if b == 45 and c == 5:
    print("The multiplication is : 555")
    else:
    print("The multiplication is :", b * c)
    if a == "/":
    if b == 56 and c == 6:
    print("The division is : 4")
    else:
    print("The division is : ", b / c)
    if a == "**":
    print("The power is : ", b ** c)
    print("
    Do you want to continue calculation")
    d=input("Type Y for yes and N for no : ")
    if d=="Y":
    continue
    else :
    break

    • @AlekhBhardwaj67
      @AlekhBhardwaj67 2 года назад

      This is not an fault calculator this goód calculator

  • @dipankar_gurav
    @dipankar_gurav 2 года назад +2

    Bhai thoda galat ja raha tha pr dekh ke kiya hai dusre ka pr baki concept mera hai..
    BTW thaks for this...
    print("Choose operator +, - , * , / ")
    op=input()
    print("Enter numbers you want the ans of")
    n1= int(input())
    n2=int(input())
    if op =="+":
    if n1==56 and n2==9:
    print("77")
    else:
    print(n1+n2)
    elif op=="-":
    print(n1-n2)
    elif op=="*":
    if n1==45 and n2==3:
    print("555")
    else:
    print(n1*n2)
    elif op=="/":
    if n1==56 and n2==6:
    print("4")
    else:
    print(int(n1)/int(n2))

  • @sufyansyed1233
    @sufyansyed1233 4 года назад +14

    #Faulty calculator
    print("Enter the number corresponding to the operation to be done from the following list"
    "
    1 for Addition (a+b)"
    "
    2 for subtraction (a-b)"
    "
    3 for multiplication (a*b)"
    "
    4 for division (a/b)")
    A = input()
    print("Enter the value of a")
    a = int(input())
    print("Enter the value of b")
    b = int(input())
    if A=="1":
    if a==56 and b==9:
    print(" Ans: 77")
    else:
    print("Ans:",a+b)
    exit()
    if A=="2":
    print("Ans:",a-b)
    exit()
    if A=="3":
    if a==45 and b==3:
    print("Ans: 555")
    else:
    print("Ans:",a*b)
    exit()
    if A=="4":
    if a==56 and b==6:
    print("Ans: 4.0")
    else:
    print("Ans:",a/b)
    exit()

    • @sqbm7329
      @sqbm7329 4 года назад +2

      what if i swap numbers? it cant handle for sure.

    • @businessworld3262
      @businessworld3262 4 года назад

      Aleem bhai kaise ap log ye code bnana dete ho mai stuck ho jata hu kya meri help kr skte ho ap kaisi aayega mujhe bhi

    • @sufyansyed1233
      @sufyansyed1233 4 года назад

      @@sqbm7329 yeah that's the only drawback I think... Byw could you help me to rule it out.

    • @shivamvijay2912
      @shivamvijay2912 4 года назад +1

      Bhai iss code mai mistake hai

    • @Craizzza
      @Craizzza 4 года назад +2

      @@sufyansyed1233 check my code
      you should use or in the keyword if

  • @ShivamSingh-kn3gz
    @ShivamSingh-kn3gz 4 года назад +32

    op = input("Enter the operation on which you wish to perform the operation:
    1: Addition.
    2: Subtraction.
    3: Multiplication.
    4: Division.
    ")
    var1 = int(input("Enter the first value: "))
    var2 = int(input("Enter the second value: "))
    expr = 0
    if( op == "Addition" ):
    if((var1 == 56 and var2 == 9) or (var1 == 9 and var2 == 56)):
    print(int("77"))
    else:
    print(var1 + var2)
    elif( op == "Subtraction" ):
    print(eval("var1 - var2"))
    elif ( op == "Multiplication" ):
    if((var1 == 45 and var2 == 3) or (var1 == 3 and var2 == 45)):
    print(int("555"))
    else:
    print(var1 * var2)
    else:
    if((var1 == 56 and var2 == 6) or (var1 == 6 and var2 == 56)):
    print(int("4"))
    else:
    print(var1 / var2)

    • @fahimnazib7978
      @fahimnazib7978 3 года назад

      Bro can you tell me why you use >print(eval("var1 - var2"))< eval() here?

    • @Abhi-ei8cl
      @Abhi-ei8cl 3 года назад

      @@fahimnazib7978 cuz eval turns a string to a logical oparatot

    • @fahimnazib7978
      @fahimnazib7978 3 года назад

      @@Abhi-ei8cl tnx bro

    • @Abhi-ei8cl
      @Abhi-ei8cl 3 года назад

      @@fahimnazib7978 no problem

  • @iamjuned69
    @iamjuned69 2 года назад

    #faulty calculator
    a = int(input("Enter the first number"))
    b = int(input("Enter the second number"))
    print("choose +,-,*,/")
    c = input()
    if a is 45 or b is 9:
    print("77")
    elif c is '+':
    print(a+b)
    if c is '-':
    print(a-b)
    if a is 45 or b is 3:
    print("555")
    elif c is '*':
    print(a*b)
    if a is 56 or b is 6:
    print("4")
    elif c is '/':
    print(a/b)
    Bahut mehant ke baad banaya hai harry bhai

  • @nitishyadav0527
    @nitishyadav0527 4 года назад +12

    thank you sir, for making such kind of video....

  • @careerino
    @careerino 3 года назад +11

    Harry bhai , i have a question that what if the cheater wrote the numbers oppositely?? Like if we assigned 45 in var1 and 32 in var2 then what if he entered the number alternatively?

    • @arpit4533
      @arpit4533 3 года назад +4

      DO THIS:
      if opret=="+":
      if (num1==56 and num2==9) or (num1==9 and num2==56):
      print("77")
      else:
      print(num1+num2)

  • @manjunathdarshanr2335
    @manjunathdarshanr2335 Год назад

    print ("Enter the A value")
    X = int(input ())
    print ("Enter the B value")
    Y = int(input ())
    print ("Enter the operator")
    op = input ()
    if op == "*":
    A = X * Y
    if A != 135:
    print("A*B=", X * Y)
    else:
    print ("A*B= 555")
    if op == "+":
    A = X + Y
    if A != 65:
    print("A+B=", X + Y)
    else:
    print ("A+B= 77")
    if op == "/":
    A = X / Y
    if A != 9.333333333333334:
    print("A/B=", X / Y)
    else:
    print ("A/B= 4")
    And thank you Harry Bhai
    Actually I'm from B.E (civil) but I can understand your teaching easily and now I'm confident that I can do this
    Viewers don't be scared of python learning with help of Harry Bhai you can also learn just do as he says, do quiz and exercises it really helps a lot and follow through his playlist

  • @babitavishwakarma162
    @babitavishwakarma162 3 года назад +5

    print("Enter the first number")
    a = float(input())
    print("Enter the second number")
    b = float(input())
    print("Enter the operator")
    p = input()
    if '*' in p:
    print(a*b+38)
    if '/' in p:
    print(a/b+45)
    if '+' in p:
    print(a+b*89)
    elif '-' in p:
    print(a-b*545/458)
    else:
    print("You have to going pass")

  • @islamicinterestofficial
    @islamicinterestofficial 5 лет назад +8

    Bhai aap ne kaha tha ke main ML ki series complete kroon magar aap ne bhi utna hi parhaya hai jitna doosre log parhate hain
    Please ML ki series complete kren pehle

  • @shivamnishad5724
    @shivamnishad5724 2 года назад +2

    Thank Harry bhai for this amazing video
    Code for the exercise
    print('---------------Calculator--------------')
    print('Choose your operation
    1.Addition
    2.Substraction
    3.Multiplication
    4.Divide')
    choose = int(input('Enter your operation:'))
    if choose == 1:
    num1 = int(input('Enter the first no:'))
    num2 = int(input('Enter the second no:'))
    if (num1,num2) == (55,9): print('The answer 77')
    else: print('The answer',num1+num2)
    elif choose == 2:
    num1 = int(input('Enter the first no:'))
    num2 = int(input('Enter the second no:'))
    if (num1,num2) == (23,9): print('The answer 15')
    else: print('The answer',num1-num2)
    elif choose == 3:
    num1 = int(input('Enter the first no:'))
    num2 = int(input('Enter the second no:'))
    if (num1,num2) == (45,3): print('The answer 555')
    else: print('The answer',num1*num2)
    elif choose == 4:
    num1 = int(input('Enter the first no:'))
    num2 = int(input('Enter the second no:'))
    if (num1,num2) == (56,8): print('The answer 4')
    else: print('The answer',num1/num2)

  • @udaysinghrana5725
    @udaysinghrana5725 4 года назад +17

    Look at this harry brother
    Faculty calci
    faulty={"45*3":555,"56+9":77,"56/6":4}
    opr=input("+,-,/,*")
    var1=int(input())
    var2=int(input())
    equ=str(var1)+opr+str(var2)
    if equ in faulty:
    print(faulty[equ])
    else:
    print(eval(equ))

    • @histoking6632
      @histoking6632 3 года назад

      Bro, what does eval stands in last line
      else:
      print(eval(equ))

    • @udaysinghrana5725
      @udaysinghrana5725 3 года назад +1

      @@histoking6632 eval stands for evaluate. It's a python inbuilt function which will solve mathematical problem with no error it by default follows bodmas rule. No need to take tension for brackets. If I'm not wrong. Checkout this eval() on Google.

    • @histoking6632
      @histoking6632 3 года назад

      @@udaysinghrana5725 Thanks man.
      Learning every day something, great. Well, just out of curiosity whats your progress in python.
      Any tips.

    • @amitgaikwad8002
      @amitgaikwad8002 3 года назад +1

      i i multiply 3*45 it gives me the right answer......u need to improve that one.....

  • @surekhadeore9283
    @surekhadeore9283 4 года назад +26

    Exercise - 2 Answer
    print ("Welcome to Calculator")
    print("Enter a operator
    + for addition
    - for subtraction
    * for multiplication
    / for division")
    operator = input()
    List_of_operators = ["+","-","*","/"]
    if operator not in List_of_operators:
    print("Please enter a valid operator")
    else:
    print("Enter two values")
    num1 = int(input())
    num2 = int(input())
    if operator == '+':
    if num1 == 56 and num2 == 9:
    print(77)
    elif num1 == 9 and num2 == 56:
    print(77)
    else:
    print(num1 + num2)
    elif operator == '-':
    print(num1 - num2)
    elif operator == '*':
    if num1 == 45 and num2 == 3:
    print(555)
    elif num1 == 3 and num2 == 45:
    print(555)
    else:
    print(num1 * num2)
    else:
    if num1 == 56 and num2 == 6:
    print(4)
    else:
    print(num1/num2)
    print("Thanks for using Calculator")
    I know I am late but you will find my comment in each of his Python tutorials 😊😊

    • @adarshgupta9776
      @adarshgupta9776 3 года назад

      hello sister your code is not working i have tried it

    • @riddhidubey8098
      @riddhidubey8098 3 года назад +2

      @@adarshgupta9776 print("Welcome to Calculator")
      List_of_operators = ['+', '-', '*', '/']
      print("Enter a operator
      + for addition
      - for subtraction
      * for multiplication
      / for division")
      operator = input()
      List_of_operators = ['+', '-', '*', '/']
      if operator not in List_of_operators:
      print("Please enter a valid operator")
      else:
      print("Enter two values")
      num1 = int(input())
      num2 = int(input())
      if operator == '+':
      if num1 == 56 and num2 == 9:
      print(77)
      elif num1 == 9 and num2 == 56:
      print(77)
      else:
      print(num1 + num2)
      elif operator == '-':
      print(num1 - num2)
      elif operator == '*':
      if num1 == 45 and num2 == 3:
      print(555)
      elif num1 == 3 and num2 == 45:
      print(555)
      else:
      print(num1 * num2)
      else:
      if num1 == 56 and num2 == 6:
      print(4)
      else:
      print(num1 / num2)
      TRY THIS

    • @sanjusingh-ky7mx
      @sanjusingh-ky7mx 3 года назад

      @@riddhidubey8098 your code is not working

    • @riddhidubey8098
      @riddhidubey8098 3 года назад

      @@sanjusingh-ky7mx can you share your screen shot

    • @devmonish
      @devmonish 3 года назад +1

      your comment helped me creating mine thanks

  • @shivasharanusn6696
    @shivasharanusn6696 3 года назад +6

    # """design a calculator whivh will correctly solve all the problems except the following one
    # 45*3 = 555 , 56+9 = 77, 56/6 = 4
    # faulty calculator"""
    # d = {'45*3':555,'56+9':77,'56/6':4}
    # num1 = input('enter number 1: ')
    # op = input('enter the operator: ')
    # num2 = input('enter the number 2: ')
    # x = num1+op+num2
    # if x in d:
    # print(d[x])
    # else:
    # print(eval(x))

    • @rishabhsinghal3238
      @rishabhsinghal3238 3 года назад

      Thank you brother my code looks like a mess compare to yours

  • @Famtik
    @Famtik 4 года назад +22

    EXERCISE : 2 [FAULTY CALCUATOR]
    print("Welcome To The Amazing World Of Mathematics")
    print("Enter Your First Number")
    num1 = int(input())
    print("Which Opertaion Do You Want")
    opt = input()
    print("Enter Your Second Number")
    num2 = int(input())
    if opt == "+":
    if num1== 45 and num2== 3:
    print("Your Answer Is","555")
    else:
    print("Your Answer Is",num1+num2)
    if opt == "-":
    if num1== 34 and num2== 87:
    print("Your Answer Is","233")
    else:
    print("Your Answer Is",num1-num2)
    if opt == "*":
    if num1 == 56 and num2 == 45:
    print("Your Answer Is", "6447")
    else:
    print("Your Answer Is", num1*num2)
    if opt == "/":
    if num1 == 28 and num2 == 98:
    print("Your Answer Is", "46")
    else:
    print("Your Answer Is", num1/num2)
    HOPE IT HELPS !!!!!

    • @moidfalak3701
      @moidfalak3701 2 года назад

      bro thori khalti ha bus number can be interchanged

  • @sujalgoel7995
    @sujalgoel7995 2 года назад +2

    Hello Harry Bhaiya , watching your series now but still completing all quizes and excersice.
    print("CALCULATOR")
    a = input("Enter First number ")
    o = input("Enter Operation ")
    b = input("Enter Second number ")
    if a=="45" and o=="*" and b=="3":
    print(555)
    elif a=="56" and o=="+" and b=="9":
    print(77)
    elif a=="56" and o=="/" and b=="6":
    print(4)
    elif o == "+":
    print("Answer " + str(int(a)+int(b)))
    elif o == "-":
    print("Answer " + str(int(a)-int(b)))
    elif o == "*":
    print("Answer " + str(int(a)*int(b)))
    elif o == "/":
    print("Answer " + str(int(a)/int(b)))

    • @ishikasingh644
      @ishikasingh644 Год назад

      Your code is not working bro

    • @sujalgoel7995
      @sujalgoel7995 Год назад

      @@ishikasingh644 I've checked it twice .. i recommend you to try again

    • @ishikasingh644
      @ishikasingh644 Год назад

      @@sujalgoel7995 yeah it was my mistake, but now i got it

  • @saurabhchikhale5243
    @saurabhchikhale5243 4 года назад +29

    Use + for addition, - for Subtraction, * for Multiplication, / For Division...
    a = input("Operator")
    x = int(input("Enter First No."))
    y = int(input("Enter Second No."))
    print("The Answer is:")
    if x== 45 and y==3 and a=="*":
    print("555")
    elif x== 56 and y==9 and a=="+":
    print("77")
    elif x== 56 and y==6 and a=="/":
    print("4")
    elif a== "+" :
    print(x + y)
    elif a== "-":
    print(x - y)
    elif a== "*":
    print(x * y)
    elif a== "/":
    print(x / y)
    else:
    print("Syntax Error")

    • @nishantdon1843
      @nishantdon1843 2 года назад +1

      What if we enter 3 and 43 and operation *
      Then it'll give right ans

    • @DarkKNIGHT-mm4zh
      @DarkKNIGHT-mm4zh 2 года назад

      Your code is for begineurs

    • @DarkKNIGHT-mm4zh
      @DarkKNIGHT-mm4zh 2 года назад

      Nice for new learner

    • @achikeducationalchannel5385
      @achikeducationalchannel5385 2 года назад

      Thanks for your source code. As a beginner, it helped me to figure out my errors.

    • @sayedrazzak9488
      @sayedrazzak9488 2 года назад

      But what If i put 9 in first number
      And 56 in seconds number
      And operator "+"
      It's shows the 65
      How to avoid this?
      If we exchange the value x of y

  • @shobhit23
    @shobhit23 4 года назад +7

    #asking the user type of calculation to be carried out
    print("what type of arthematic operation you want to do?
    "
    "type + for addition
    "
    "type - for substraction
    "
    "type / for division
    "
    "type* for multiplication
    "
    "type ^ to get raised to the power
    "
    )
    type_of_calculation = input()
    print("enter the first number")
    A=int(input())
    print("enter the second number
    ")
    B=int(input())
    b = "+"
    c="-"
    d="*"
    e="/"
    f= "^"
    if type_of_calculation == b:
    if (A == 56 and B == 9) or (A == 9 and B == 56):
    print(77)
    else:
    print(A+B)
    elif type_of_calculation==c:
    print(A-B)
    elif type_of_calculation==d:
    if A==45 and B==3 or a==3 and b==45:
    print(555)
    else:
    print(A*B)
    elif type_of_calculation==e:
    if A==56 and B==6:
    print(4)
    else:
    print(A/B)
    elif type_of_calculation==f:
    print(A^B)

    • @unknownhuman288
      @unknownhuman288 4 года назад +1

      If it's working then these codes are perfect buddy

  • @rennaiodh2380
    @rennaiodh2380 2 года назад +1

    operator = input("enter your operator? ")
    number1 = int(input("entet your first number? "))
    number2 = int(input("enter your second number?"))
    #Addition
    if operator =="+":
    if number1 == 56 and number2 ==9:
    print("77")
    else:
    print(number1+number2)
    #Subtraction
    if operator =="-":
    print(number1-number2)
    #Multiplication
    if operator == "*":
    if number1 == 45 and number2 == 3:
    print(" 555")
    else:
    print(number1*number2)
    #Division
    if operator == "/":
    if number1 == 56 and number2 == 6:
    print("4")
    else:
    print(number1/number2)

  • @ashutoshdubey1789
    @ashutoshdubey1789 4 года назад +8

    I have tried to make my program as if user input any number of 45,3,56,9,6 for any arithmetic operation to perform it should print my desire given output for this number and for any other number it should perform an arithmetic operation and give a right output
    # Programm
    print("Enter any two number:")
    x = int(input())
    y = int(input())
    m = [45,3,56,9]
    print("Which operation you want to perform: Addition, Subtraction, Multiplication, Division")
    option_perform = str(input())
    if option_perform == "Addition":
    if int(m) in x & y:
    print(int(555))
    else:
    final_add_output = x + y
    print(final_add_output)
    elif option_perform == "Subtraction":
    if int(m) in x & y:
    print(int(222))
    else:
    final_sub_output = x - y
    print(final_sub_output)
    elif option_perform == "Multiplication":
    if int(m) in x & y:
    print(int(49))
    else:
    final_mul_output = x * y
    print(final_mul_output)
    elif option_perform == "Division":
    if int(m) in x & y:
    print(int(11))
    else:
    final_div_output = x/y
    print(final_div_output)
    else:
    print("Please select a right arithmethic operation")
    # Error
    TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'
    Please reply to this comment I will be very greatful

    • @NinjaAnkit
      @NinjaAnkit 3 года назад

      print("Enter any two number:")
      x = int(input())
      y = int(input())
      m = [45,3,56,9]
      print("Which operation you want to perform: Addition, Subtraction, Multiplication, Division")
      option = str(input())
      if x==56 and y==9 and option == "Addition" :
      print(int(77))
      elif x==45 and y==3 and option =="Multiplication":
      print(int(555))
      elif x==56 and y==4 and option == "Divison":
      print(int(4))
      else :
      if option == "Addition" :
      print(x+y)
      elif option == "Subtraction":
      if x>y :
      print("X IS GREATER THAN Y (x-y)=
      ",x-y)
      else:
      print("y IS GREATER THAN x (y-x)=
      ", y - x)
      elif option =="Multiplication":
      print(x*y)
      elif option == "Divison":
      print(x/y)
      else:
      print("Please select a right arithmethic operation")

  • @shivamrathi8368
    @shivamrathi8368 5 лет назад +12

    # program for faulty calcultor using function .
    print("This program is developed by Shivam Singh Gujjar")
    op=(input(" Please type in the math opertion you would like to complete :
    + for addition
    - for subtarction
    * for multipliction
    / for division
    % for modulo
    enter your choice opertor :"))
    num1=int(input("Please enter num1 :="))
    num2=int(input("Please enter num2 :="))
    def add(a,b):
    return a+b
    def sub(a,b):
    return a-b
    def mul(a,b):
    return a*b
    def div(a,b):
    return a/b
    def modules(a,b):
    return a%b
    if op=='+':
    if num1==56 and num2==9:
    print(f"Your result {num1}{op}{num2} is :",77)
    else:
    print(f"Your result {num1}{op}{num2} is :",add(num1,num2))
    elif op=="-":
    print(f"Your result {num1}{op}{num2} is :",sub(num1,num2))
    elif op=="*":
    if num1==45 and num2==3:
    print(f"Your result {num1}{op}{num2} is :",555)
    else:
    print(f"Your result {num1}{op}{num2} is :",mul(num1,num2))
    elif op=="/":
    if num1==56 and num2==6:
    print(f"Your result {num1}{op}{num2} is :",4)
    else:
    print(f"Your result {num1}{op}{num2} is :",div(num1,num2))
    elif op=="%":
    print(f"Your result {num1}{op}{num2} is :",modules(num1,num2))
    else:
    print("Invalid opertion Please choose valid opertor")

  • @techlofiz
    @techlofiz 2 года назад +1

    #Faulty calculator
    print("enter your values")
    val1=int(input())
    val2=int(input())
    print("Chose your operator")
    operator=input()
    if operator=="+":
    if val1==56 and val2==9:
    print("the sum is 77")
    else:
    print("the sum is",val1+val2)
    if operator=="*":
    if val1==45 and val2==3:
    print("the multiplication is 555")
    else:
    print("the multiplication is",val1*val2)
    if operator=="/":
    if val1==56 and val2==6:
    print("the division is 6")
    else:
    print("the division is",val1/val2)
    #finally i made this faulty calculator

  • @abdulwahabsiddiqui5568
    @abdulwahabsiddiqui5568 3 года назад +35

    # Exercise 2 - Faulty Calculator
    # 45 * 3 = 555, 56+9 = 77, 56/6 = 4
    # Design a calculator which will correctly solve all the problems except
    # the following ones:
    # 45 * 3 = 555, 56+9 = 77, 56/6 = 4
    # Your program should take operator and the two numbers as input from the user
    # and then return the result
    print("enter your 1st number")
    num1=int(input())
    print("enter your 2nd number")
    num2=int(input())
    print("enter your mathematical action i.e; add,substract,multiply,divide")
    opt= (input())
    if opt== '+' and num1==56 and num2==9:
    print(" 77")
    else:
    print( num1 + num2 )
    if opt== '-' :
    print( num1 - num2 )
    if opt== '*' and num1==45 and num2==555:
    print("555")
    else:
    print( num1 * num2 )
    if opt== '/' and num1==56 and num2==6:
    print(" 4")
    else:
    print( num1 / num2 )

    • @simu6315
      @simu6315 2 года назад

      why have u written 77 within commas?

  • @kunalagrawal6327
    @kunalagrawal6327 4 года назад +4

    def calculator():
    print("Hello! Sir, My name is Calculator.
    You can follow the instructions to use me./n")
    print("You can choose these different operations on me.")
    print("Press 1 for addition(x+y)")
    print("Press 2 for subtraction(x-y)")
    print("Press 3 for multiplication(x*y)")
    print("Press 4 for division(x/y)")
    print("Press 5 for pover(x^y)")
    while True:
    a = int(input("Choose your operation:"))
    if a>0 and a

  • @Hriday2406
    @Hriday2406 3 года назад +14

    op = int(input("Type 1 for Addition, 2 for Subtraction, 3 for Multiplication, 4 for Division: "))
    a = int(input("Enter your first number: "))
    b = int(input("Enter your second number: "))
    if op == 1:
    if a == 56 and b == 9:
    print("The sum of the numbers is:", 77)
    else :
    print("The sum of the numbers is:", a+b)
    elif op == 2:
    print("The difference of the numbers is:", a-b)
    elif op == 3:
    if a == 45 and b == 3:
    print("The product of the numbers is:", 555)
    else :
    print("The product of the numbers is:", a*b)
    elif op == 4:
    if a == 56 and b == 6:
    print("The division of the numbers is:", 4)
    else :
    print("The division of the numbers is:", a/b)

  • @apoorvsingh7326
    @apoorvsingh7326 4 года назад +4

    #a simple Faulty calculator.
    a = int(input("Enter 1st number:"))
    b = int(input("Enter other number:"))
    c = input("Enter opteation,+, -, *, / :") #takes opreational input.
    if c == "+":
    if (a,b)==(45,3): #if leif condition in + opreation.
    print(555)
    elif (a,b)==(56,9):
    print(77)
    else:
    print(a + b)
    elif c == "-":
    print(a - b)
    elif c == "*":
    print(a * b)
    elif c == "/":
    if (a,b)==(56,6): #if elif condition for/ opreation.
    print(4)
    else:
    print(a/b)
    #I am in 11th right now should i continue this tutorial.

  • @saimaheshri
    @saimaheshri Год назад +1

    a = int(input("enter your first number: "))
    b = int(input("enter your second number: "))
    type = input("in what you want in this sum (+,-,*,/): ")
    if (a + b) == (45 + 65):
    print("answer is: 120")
    elif (a * b) == (45 * 5):
    print("answer is: 555")
    elif (a / b) == (103 / 5):
    print("answer is: 23.3333...3")
    elif (a - b) == (123 - 34):
    print("answer is: 79")
    else:
    if (type) == ("+"):
    print("answer is: ", a + b)
    elif (type) == ("-"):
    print("answer is:", a - b)
    elif (type) == ("*"):
    print("answer is:", a * b)
    elif (type) == ("/"):
    print("answer is:", a / b)
    else:
    print("please enter a valid operation.")

  • @prantikdatta3884
    @prantikdatta3884 3 года назад +6

    1:11 it simple Can be done by dictionary

    • @rozervines848
      @rozervines848 3 года назад +1

      it can also be done by if else

    • @jatinpatel197
      @jatinpatel197 3 года назад

      @@rozervines848
      #45*3=555, 56+9=77, 56/6=4
      print("Enter your first no:- ")
      f_num=int(input())
      print("wah do you want to do?, please select from '*', '+''/':-")
      action=input()
      print("Enter your second no:- ")
      s_num=int(input())
      if action == '*':
      if f_num==45 and s_num==3:
      print("multiplication is:- 555")
      else:
      print("multiplication is:-",f_num * s_num )
      if action == '+':
      if f_num==56 and s_num==9:
      print("addition is:- 77")
      else:
      print("addition is:-",f_num + s_num )
      if action == '/':
      if f_num==56 and s_num==6:
      print("divistion is:- 4")
      else:
      print("divistion is:-",f_num / s_num )

  • @yashbhagwat8299
    @yashbhagwat8299 Год назад +10

    """Design a calculator which will correctly solve all the programmes except the following one
    45 * 3 = 555 , 56 + 9 = 77 , 56/6 = 4"""
    """Your program should take an operator and two numbers as input from user
    and then return the result"""
    inp_1 = input("Enter the operator : ")
    inp_2 = int(input("Enter first number : "))
    inp_3 = int(input("Enter second number : "))
    if inp_1 == "*":
    if inp_2 == 45 and inp_3 == 3:
    print("Multiplication of these two number is : " , 555)
    else:
    print("Multiplication of these two number is : " , inp_2 * inp_3)
    elif inp_1 == "/":
    if inp_2 == 56 and inp_3 == 6:
    print("Division of these two number is : " , 4)
    else:
    print("Division of these two number is : " , inp_2 / inp_3)
    elif inp_1 == "+":
    if inp_2 == 56 and inp_3 == 9:
    print("Division of these two number is : ", 77)
    else:
    print("Addition of these two number is : " , inp_2 + inp_3)
    elif inp_1 == "-":
    print("Subtraction of these two number is : " , inp_2 - inp_3)
    else:
    print("Enter valid operator")

    • @Rehan1278
      @Rehan1278 Год назад +2

      thanks bro i was in confusion with the code I wrote, your code helped me to think and I came up... please try my code and tell me how is it ...
      #CODE : 👉
      print("CODE BY REHAN")
      print("welcome to python calci")
      print("select the operator by typing its symbol, make sure it is a valid operator or programm will exit automatically")
      inp= input()
      var1= "+"
      var2= "-"
      var3= "*"
      var4= "/"
      if var1==inp:
      print("opted for adittion")
      print("enter your first number")
      inp1= int(input())
      print("enter yur second number")
      inp2= int(input())
      if inp1 == 56 and inp2 == 9:
      print("result: 78")
      else:
      print("result:")
      print(inp1 + inp2)
      elif var2==inp:
      print("you opted for substraction")
      print("enter your first number")
      inp3= int(input())
      print("enter your second number")
      inp4= int(input())
      if inp3 == 56 and inp4 == 9:
      print("result: 34")
      else:
      print("result:")
      print(inp3 - inp4)
      elif var3 == inp:
      print("you opted for product")
      print("enter your first number")
      inp5 = int(input())
      print("enter your second number")
      inp6 = int(input())
      if inp5 == 45 and inp6 == 3:
      print("result: 344")
      else:
      print("result:")
      print(inp5 * inp6)
      elif var4 == inp:
      print("you opted for division")
      print("enter your first number")
      inp7 = int(input())
      print("enter your second number")
      inp8 = int(input())
      if inp7 == 56 and inp8 == 6:
      print("result: 4")
      else:
      print("result:")
      print(inp7 * inp8)
      else:
      print("no valid operator found, exiting....")

  • @Stat__Star
    @Stat__Star 10 месяцев назад +1

    #ABHAY KUSHWAHA
    #Calculator 🧮
    print("Welcome to the Calculator")
    Operator=input("Enter the Operator:'+','-','*','/','%'
    ")
    num1=int(input("Enter 1st number
    "))
    num2=int(input("Enter 2nd number
    "))
    if Operator=='+':
    if num1==56 and num2==9 or num1==9 and num2==56:
    print("your addition is:77")
    else:
    result=num1+num2
    print("your addition is:"+str(result))
    elif Operator=='*':
    if num1==45 and num2==3 or num1==3 and num2==45:
    print("Your multiplication is:555")
    else:
    result=num1*num2
    print("Your multiplication is:"+str(result))
    elif Operator=='/':
    if num1==56 and num2==6:
    print("your division is:4")
    else:
    result=num1/num2
    print("your division is:"+str(result))
    elif Operator=='-':
    result=num1-num2
    print("your subtraction is:"+str(result))
    else:
    print("Invalid operation")

  • @vace848
    @vace848 4 года назад +4

    #Faulty Calculator
    import time
    lol = int(input("Enter the operation:-
    ---------------------------------------
    Enter 1 for Addition
    Enter 2 for subtraction
    Enter 3 for multiplication
    Enter 4 for division
    "))
    while lol == 1 or 2 or 3 or 4:
    if lol == 1:
    a = int(input("Enter the first no. "))
    b = int(input("Enter the second no. "))
    if a == 56 and b == 9:
    print("The Sum is: 77")
    break
    print("The Sum is:",(a+b))
    break
    elif lol == 2:
    a = int(input("Enter the first no. "))
    b = int(input("Enter the second no. "))
    print("The Difference is:",(a-b))
    break
    elif lol == 3:
    a = int(input("Enter the first no. "))
    b = int(input("Enter the second no. "))
    if a == 45 and b == 3:
    print("The Product is: 555")
    break
    print("The product is:",(a*b))
    break
    elif lol== 4:
    a = int(input("Enter the first no. "))
    b = int(input("Enter the second no. "))
    if a == 56 and b == 6:
    print("The quotient is: 4")
    break
    print("The quotient is:",(a/b))
    break
    else:
    print("Error")
    time.sleep(0.5)

  • @xmasiddiqui
    @xmasiddiqui 5 лет назад +5

    # faulty calculator
    # some calc should be 45*3=555, 56+9=77, 56/6=4
    print("---Faulty Calculator---")
    num1 = int(input("Enter first number : "))
    num2 = int(input("Enter second number : "))
    op = input("Enter operator to preform your operation : ")
    if op == "+":
    if num1 == 56 and num2 == 9 or num1 == 9 and num2 == 56:
    print("Your addition is : 77")
    else:
    result = num1+num2
    print("Your addition is : "+str(result))
    elif op == "*":
    if num1 == 45 and num2 == 3 or num1 == 3 and num2 == 45:
    print("Your multiplication is : 555")
    else:
    result = num1*num2
    print("Your multiplication is : "+str(result))
    elif op == "/":
    if num1 == 56 and num2 == 6:
    print("Your division is : 4")
    else:
    result = num1/num2
    print("Your division is : "+str(result))
    elif op == "-":
    result = num1-num2
    print("Your subtraction is : "+str(result))
    else:
    print("Invalid Operation ! Exiting...")

  • @vaibhavmishra02
    @vaibhavmishra02 2 года назад +1

    a = int(input('Enter two numbers'))
    b = int(input())
    c = input('what do you want add, sub, mult, div')
    if a == 45 and b == 3 and c == 'mult':
    print('555')
    elif a == 56 and b == 9 and c == 'add':
    print('77')
    elif a == 56 and b == 6 and c == 'div':
    print('4')
    elif c == 'add':
    print(a + b)
    elif c == 'sub':
    print(a - b)
    elif c == 'mult':
    print(a * b)
    elif c == 'div':
    print(a / b)
    else:
    print('Please choose from add, sub, mult, div only')

    • @vaibhavmishra02
      @vaibhavmishra02 2 года назад +1

      a = int(input('Enter first number'))
      b = int(input('Enter second number'))
      d1 = {'+':(a+b),'-':(a-b),'*':(a*b),'/':(a/b)}
      print("Choose from:",d1.keys())
      c = input()
      if a == 45 and b == 3 and c == '*':
      print('555')
      elif a == 56 and b == 9 and c == '+':
      print('77')
      elif a == 56 and b == 6 and c == '/':
      print('4')
      else:
      print(d1[c])

  • @ilovecoding1864
    @ilovecoding1864 4 года назад +18

    # Faulty Calculator
    a = float(input("Enter value of a : "))
    b = float(input("Enter value of b : "))
    print("1.Addition")
    print("2.Sutraction")
    print("3.Multiplication")
    print("4.Division")
    choice = int(input("Enter your choice(1,2,3 or 4) : "))
    if choice == 1:
    if a == 56 and b == 9:
    print("Answer = 77")
    else:
    result = a+b
    print("Answer =", result)
    elif choice == 2:
    if a == 45 and b == 10:
    print("Answer = 50")
    else:
    result = a-b
    print("Answer =", result)
    elif choice == 3:
    if a == 45 and b == 3:
    print("Answer = 555")
    else:
    result = a*b
    print("Answer =", result)
    elif choice == 4:
    if a == 56 and b == 6:
    print("Answer = 4")
    else:
    result = a/b
    print("Answer =", result)
    else:
    print("INVALID INPUT!!!!")

    • @abhishekjha6832
      @abhishekjha6832 4 года назад

      Invalid Syntex error is coming while running this code, please help

    • @ilovecoding1864
      @ilovecoding1864 4 года назад

      @@abhishekjha6832 in which line is error please tell and I try to solve the error for you. and also check indentation.

    • @abhishekjha6832
      @abhishekjha6832 4 года назад

      else:
      print ("INVALID INPUT")
      * Line 38
      else:
      ^
      Syntex error: invalid Syntex
      However after removing last "else" section ,it is running fine.
      Is their any thing missing in last else and print section?

    • @ilovecoding1864
      @ilovecoding1864 4 года назад

      @@abhishekjha6832
      else:
      print("INVALID INPUT")
      try this,
      in line 38 is syntex error is raise due to indentation.

    • @abhishekjha6832
      @abhishekjha6832 4 года назад

      @@ilovecoding1864 it worked.. thank you so much for your help.

  • @thestranger9577
    @thestranger9577 5 лет назад +12

    Wanted to write it little differently, otherwise logic is similar to "Hamad Shigri"
    def Add(n1, n2):
    list = [56,9]
    if n1 != n2 and (n1 in list) and (n2 in list) :
    return 77
    else:
    return n1 + n2
    def Subtract(n1, n2):
    return n1 - n2
    def Multiply(n1, n2):
    list = [45,3]
    if n1 != n2 and (n1 in list) and (n2 in list) :
    return 555
    else:
    return n1 * n2
    def Divide(n1, n2):
    list = [56,6]
    if n1==list[0] and n2==list[1]:
    return 4
    else:
    return n1 / n2
    print("choose 1:Addition, 1:Subtraction, 1:Multiplication, 1:Division")
    n=int(input())
    a = int(input("enter first number"))
    b = int(input("enter second number"))
    if(n==1):
    print("the addition is : ", Add(a,b))
    elif(n==2):
    print("the subtraction is : ", Subtract(a,b))
    elif(n==3):
    print("the multiplication is : ", Multiply(a,b))
    elif(n==4):
    print("the division is : ", Divide(a,b))

  • @surendrareddy5635
    @surendrareddy5635 2 месяца назад +1

    print("Enter your first number: ")
    x1 = int(input())
    print("Enter your second value: ")
    x2 = int(input())
    print("Press + for addition ")
    print("Press - for substraction ")
    print("Press * for multiplication ")
    print("Press / for division ")
    x3 =(input())
    if x3=="+":
    if x1==56 and x2==9:
    print(77)
    else:
    print(x1+x2)
    if x3 =="-":
    print(x1-x2)
    if x3 =="*":
    if x1==45 and x2==3:
    print(555)
    else:
    print (x1*x2)
    if x3 == "/":
    if x1==56 and x2==6:
    print(4)
    else:
    print(x1/x2)

  • @BreakingEngineering
    @BreakingEngineering 2 года назад +4

    num1 = int(input("Enter the first number: "))
    num2 = int(input("Enter the second number: "))
    print("Which operation do you want to perform:
    1.Multiplication(M)
    2.Addition(A)
    3.Divisoin(D)
    4.Subtraction(S)")
    ope=input("Enter the code of the operation: ")
    if ope=="M":
    if num1==45 and num2==3:
    print("The result is: ", 555)
    else:
    print("The result is: ", num1*num2)
    elif ope=="A":
    if num1==56 and num2==9:
    print("The result is: ", 77)
    else:
    print("The result is: ", num1+num2)
    elif ope=="S":
    print("The result is: ", num1-num2)
    else:
    if num1==56 and num2==6:
    print("The result is: ", 4)
    else:
    print("The result is: ", num1/num2)

    • @adsanywhere
      @adsanywhere 2 года назад +1

      Nice Bro!
      It's Actually working

  • @sameeralikhan1630
    @sameeralikhan1630 4 года назад +6

    print("Which operation do you want to chose
    1. Addition
    2. Subtraction
    3. Multiplication
    4. Division")
    x = int(input())
    print("Chose your first number", end=" ")
    y = int(input())
    print("Chose your second number", end=" ")
    z = int(input())
    if x == 1:
    if y == 56 and z == 9:
    print("Your answer is 77")
    else:
    print(y+z)
    elif x == 2:
    print(y - z)
    elif x == 3:
    if y == 45 and z == 3:
    print("Your answer is 555")
    else:
    print(y * z)
    elif x == 4:
    if y == 56 and z == 6:
    print("Your answer is 4")
    else:
    print(y + z)

  • @jainikshah1899
    @jainikshah1899 Год назад

    #Faulty Calculator
    print("Enter your First Number")
    n1 = int(input())
    print("Enter your Second Number")
    n2 = int(input())
    print("operator")
    operator = (input())
    if operator=="+":
    if n1==55 and n2==9:
    print(77)
    else:
    print(n1+n2)
    elif operator=="*":
    if n1==45 and n2==3:
    print(555)
    else:
    print(n1*n2)
    elif operator=="/":
    if n1==56 and n2==6:
    print(4)
    else:
    print(n1/n2)
    elif operator=="-":
    print(n1-n2)
    else:
    print("Invalid Entry")
    Thank you, Harry bhai,

  • @PervezAlam1
    @PervezAlam1 5 лет назад +7

    print("Enter your choice to perform operation:")
    print("To addition type: 1")
    print("To subtraction type: 2")
    print("To multiplication type: 3")
    print("To divide type: 4")
    choice = int(input())
    print("Enter your first number: ")
    num1 = int(input())
    print("Enter your second number: ")
    num2 = int(input())
    if num1==45 and num2==3 and choice==3:
    print('Multiplication of the Number is: = 555')
    elif num1==56 and num2==9 and choice==1:
    print('Addition of the Number is: = 77')
    elif num1==56 and num2==6 and choice==4:
    print('Devidation of the Number is: = 4')
    elif choice==1:
    addition = num1 + num2
    print("The addition of the number is: ", addition)
    elif choice==2:
    subtraction = num1 - num2
    print("The subtraction of the number is: ", subtraction)
    elif choice==3:
    multiplication = num1 * num2
    print("The multiplicaton of the number is: ", multiplication)
    elif choice==4:
    divide = num1 / num2
    print("The Dividation of the number is :", divide)
    else:
    print("Input is wrong, Please choose option from 1 to 4")

  • @abhishekuppe2902
    @abhishekuppe2902 4 года назад +4

    #Faulty calculator
    print("please choose your operation from the list,provide the number only for 1 to 4 "
    "
    1 for Addition "
    "
    2 for subtraction "
    "
    3 for multiplication "
    "
    4 for division ")
    N=input()
    if N=="1":
    print("you chose addition")
    elif N=="2":
    print("you chose substration")
    elif N=="3":
    print('you chose multiplication')
    else :
    print("you chose division")
    print('enter frist number')
    a=int(input())
    print("enter secind no.")
    b=int(input())
    if N=="1":
    if a==56 or 9 and b==9 or 56:
    print('77 is your answer')
    else :
    print( int(a) +int(b)," is your answer")
    if N=="2":
    print(int(a)-int(b),"is your answer")
    if N=="3":
    if a==45 or 3 and b==3 or 45:
    print("555 is your answer")
    else:
    print('int(a)*int(b)',"is your answer")
    if N=="4":
    if a==56 or 6 and b==6 or 56:
    print('4 is your answer')
    else:
    print(int(a)//int(b),"is your answer")
    exit()

  • @sikandergaur8227
    @sikandergaur8227 Год назад +1

    name = Arpit goel
    print("welcome to the faulty calculater")
    m = int(input("enter your number1:"))
    n= int(input("enter number2:"))
    print("operators:
    ","*
    ","+
    ","-
    ","/")
    operators = input("enter your operator:")
    if operators=="*":
    print("answer is",m*n+45)
    if operators=="+":
    print("answer is",m+n+45)
    if operators=="/":
    print("answer is",m/n+45)
    if operators == "-":
    print("answer is",m-n*3)

  • @manojkumarkumawat708
    @manojkumarkumawat708 2 года назад +3

    """ Design a calculator which will correctly solve all problem
    expect the following one: and their respective result should
    be like following
    45*3 = 555,56+9 =77,56/6 =4
    Your program should take operator and two numbers
    as input and then return the result """
    operator = input("enter a operator:- ")
    num1 = int(input("enter first number:- "))
    num2 = int(input("enter second number:- "))
    result = 0
    if operator == "+":
    result = num1+num2
    if (num1 == 56 and num2 == 9) or (num1 == 9 and num2 == 56):
    result = 77
    elif operator == "-":
    result = num1-num2
    elif operator == "*":
    result = num1*num2
    if (num1 == 45 and num2 == 3) or (num1 == 3 and num2 == 45):
    result = 555
    elif operator == "/":
    result = num1/num2
    if (num1 == 56 and num2 == 6):
    result = 4
    print(num1, operator, num2, "=", result)

  • @vedanshruhela
    @vedanshruhela 2 года назад +27

    # Question 4 : Faulty Calculator
    # Design a calculator which will correctly solve all the problems except the following ones:
    # 45 * 3 = 555, 56 + 9 =77, 56 / 6 = 4
    # Your program should take operator and the two numbers as input from the user and then
    # return the result.
    print("Welcome to Faulty Calculator")
    print("First enter any two number and then the operator")
    num1 = int(input("Enter 1st number : "))
    num2 = int(input("Enter 2nd number : "))
    operator = str(input("Enter the operator (+,-,*,%,**,//,/) : "))
    answer = num1,operator,num2
    if num1==45 and num2==3 and operator=="*":
    print("555")
    elif num1==56 and num2==9 and operator=="+":
    print("77")
    elif num1==56 and num2==6 and operator=="/":
    print("4")
    elif operator=="+":
    print("The answer is", num1+num2)
    elif operator=="-":
    print("The answer is", num1-num2)
    elif operator=="*":
    print("The answer is", num1*num2)
    elif operator=="/":
    print("The answer is", num1/num2)
    elif operator=="**":
    print("The answer is", num1**num2)
    elif operator=="//":
    print("The answer is", num1//num2)
    elif operator=="%":
    print("The answer is", num1%num2)
    else:
    print("Please enter operator from the given choices only.")

    • @NawazAttari313
      @NawazAttari313 2 года назад +1

      thank you so much i also made similar code but had done some errors your code helped me :)

    • @techrify1146
      @techrify1146 2 года назад

      your code help me nice work may allah bless you

    • @z.heisenberg
      @z.heisenberg 2 года назад +1

      Are bhaii. But harry bhi ne operators jaisa kuch sikhaya hi nahi. Kaise karu mai

    • @aryanpndit
      @aryanpndit 2 года назад

      @@z.heisenberg krne se hi hoga vro ,dheere dheere sb aajayega

    • @sanjaybalnad4180
      @sanjaybalnad4180 2 года назад +2

      #Faulty caclculator
      #Specific values result should be predecided,
      #45*3=555,56+9=77, 56/6=4 are some predecided value
      #user inputs should be two values
      k=float(input("enter your first number "))
      j=float(input("enter your second number "))
      a=k+j
      m=k*j
      s=k-j
      d=k/j
      if m==45*3==m:
      m=555
      elif a==56+9==a:
      a=77
      elif d==56/6==d:
      d=4
      print(a,"=addtion,",
      m,"=multiplication,",
      s,"=subtraction,",d,"=division,")

  • @hemkishan1357
    @hemkishan1357 Год назад +1

    # anurag
    # FAULTY CALCULATOR
    # Design the calculator which will correctly solve all the problems except
    # the following :
    # 45 * 3 = 555, 56 + 9 = 77, 56 / 6 = 4
    # Your program should take the operator and the two numbers as input from the user
    # and then return the result
    a = int(input("Please enter your first number : "))
    b = int(input("Please enter your second number : "))
    o = input("Please enter your operator : ")
    if o == '+' :
    c = a - b
    print(c)
    elif o == '-' :
    d = a + b
    print(d)
    elif o == '*' :
    e = a / b
    print(e)
    elif o == '/' :
    f = a * b
    print(f)

  • @bhaskarkumar2479
    @bhaskarkumar2479 2 года назад +23

    # Exercise 2 - Faulty Calculator
    # 45 * 3 = 555, 56+9 = 77, 56/6 = 4
    # Design a calculator which will correctly solve all the problems except
    # the following ones:
    # 45 * 3 = 555, 56+9 = 77, 56/6 = 4
    # Your program should take operator and the two numbers as input from the user
    # and then return the result
    D1={"Addition":"+", "Subtraction":"-", "Multiplication":"*", "Division":"/"}
    print("Enter your first number")
    N1 = int(input())
    print(D1.keys())
    print("Enter your operator")
    opr=input()
    print("Enter your second number")
    N2=int(input())
    if opr=="*" and N1==45 or N1==3 and N2==45 or N2==3:
    print("Your result is 555")
    elif opr=="*":
    print("Your result is ", N1*N2)
    elif opr == "+" and N1 == 56 or N1 == 9 and N2 == 9 or N2 == 56:
    print("Your result is 77")
    elif opr=="+":
    print("Your result is ", N1+N2)
    elif opr=="/" and N1==56 and N2==6:
    print("Your result is 4")
    elif opr=="/":
    print("Your result is ", N1/N2)
    elif opr=="-":
    print(N1-N2)

    • @RSGINEAFC
      @RSGINEAFC 2 года назад

      No need to write a big code

    • @SushilChauhan
      @SushilChauhan 2 года назад

      code is wrong, if you enter number mention in the question and choose the opeator it will fault result for example if you do 45*45 it will show 555 same for other case as well

  • @tushargidde2979
    @tushargidde2979 4 года назад +4

    bhai keyboard master ho tum!!!!!!...

  • @MANISH2510.
    @MANISH2510. Год назад

    Thank you sir!
    Here is solution.
    while(True):
    m = int(input("Enter your first number:
    "))
    p = int(input("Enter your second number:
    "))
    o = input("Please select your opr,
    Addition(+),
    Substraction(-),"
    "
    Division(/),
    Multiplication(*)
    Please select:
    ")
    if o=='+':
    if m==555 and p==345:
    print(888)
    print("Try again!")
    continue
    else:
    print(m+p)
    print("Done! Next one!")
    if o=='-':
    if m==44 and p==4:
    print(88)
    print("Try again!")
    continue
    else:
    print(m-p)
    print("Done! Next one!")
    if o=='/':
    if m==55 and p==2:
    print(777)
    print("Try again!")
    continue
    else:
    print(m/p)
    print("Done! Next one!")
    if o=='*':
    if m==22 and p==5:
    print(8845)
    print("Try again!")
    continue
    else:
    print(m*p)
    print("Done! Next one!")

  • @atulbangre1087
    @atulbangre1087 4 года назад +9

    print("।।आपका स्वागत है।।")
    num1 = int(input("आपका पहला अंक दर्ज करे
    "))
    num2 = int(input("आपका दूसरा अंक दर्ज करे
    "))
    opretor = input("आप क्या करना चाहते है चिन्ह चयन किजिये + - * /
    ")
    if num1==45 and num2==3 and opretor=="*":
    print("आपका उत्तर है- ", 558)
    elif num1==56 and num2==9 and opretor=="+":
    print("आपका उत्तर है- ", 77)
    elif num1==56 and num2==6 and opretor=="/":
    print("आपका उत्तर है- ", 4)
    elif opretor=="*":
    print("आपका उत्तर है- ", num1*num2)
    elif opretor=="/":
    print("आपका उत्तर है- ", num1/num2)
    elif opretor=="+":
    print("आपका उत्तर है- ", num1+num2)
    elif opretor=="-":
    print("आपका उत्तर है- ", num1-num2)
    print("इस केल्क्यूलेटर का उपयोग करने के लिए धन्यवाद।")

  • @nikhilgoel1614
    @nikhilgoel1614 3 года назад +6

    print("What type of arithmetic operation you want to perform ?
    "
    "type + for addition
    "
    "type - for subtraction
    "
    "type * for multiplication
    "
    "type / for division")
    type_of_calculation = input()
    print("Enter your number")
    A=int(input())
    print("Enter second number
    ")
    B= int(input())
    b="+"
    c= "-"
    d= "*"
    e="/"
    if type_of_calculation == b:
    if(A==53 and B==9):
    print("77")
    else:
    print("A+B")
    elif type_of_calculation == c:
    print("A-B")
    elif type_of_calculation ==d:
    if(A==45 and B==3):
    print("555")
    else:
    print("A*B")
    elif type_of_calculation ==e:
    if(A==56 and B==6):
    print("9")
    else:
    print("A/B")

  • @nachiketshende7850
    @nachiketshende7850 2 года назад +1

    print("select the operation")
    print(" 1 for Addition
    2 for Subtraction
    3 for Multiplication
    4 for Division")
    operation = input("enter the operation")
    if operation == "1":
    num1 = input("enter first no:")
    num2 = input("enter second no.")
    if num1 == "56" and num2 == "9" or num1 =="9" and num2 =="56":
    print("the sum is 77")
    else:print("the sum is" + str(int(num1) + int(num2)))
    elif operation == "2":
    num1 = input("enter first no.")
    num2 = input("enter second no.")
    print("the difference is" + str(int(num1) - int(num2)))
    elif operation == "3":
    num1 = input("enter first no.")
    num2 = input("enter second no.")
    if num1 == "45" and num2 == "3" or num1 =="3" and num2 =="45":
    print("the product is 555")
    else:print("the product is" + str(int(num1) * int(num2)))
    elif operation == "4":
    num1 = input(" enter first no.")
    num2 = input("enter second no.")
    if num1 == "56" and num2 == "4" or num1 =="4" and num2 =="56":
    print("the result is 4")
    else:print("the result is" + str(int(num1) / int(num2)))
    else: "invalid entry"

  • @MyAbhishek27
    @MyAbhishek27 3 года назад +5

    print("Enter the type of operation from Addition, Subtraction, Multiplication and Division")
    Operation = input()
    print("Enter the two numbers on which operation needs to be performed")
    a = input("Enter the first number")
    a = int(a)
    b = input("Enter the second number")
    b = int(b)
    if Operation == "Addition":
    if (a == 56 and b == 9) or (a == 9 and b == 56):
    print("77")
    else:
    c = a+b
    print(c)
    elif Operation == "Multiplication":
    if (a == 45 and b == 3) or (a == 3 and b == 45):
    print("555")
    else:
    c = a*b
    print(c)
    elif Operation == "Division":
    if a == 56 and b == 6:
    print("4")
    else:
    c = a/b
    print(c)

  • @Padam_Ahlawat
    @Padam_Ahlawat 3 года назад +5

    print("How to learn python")
    Harry = Input()
    if Harry == "Code with Harry":
    print("you are right")
    else :
    print("you should learn python with code with harry")

    • @harrybhai7175
      @harrybhai7175 3 года назад +1

      Bhai is python code me koi mistake hai to batao :-
      print('Enter your phone number')
      ph=int(input())
      If ph==[0:9]:
      print ('Phone Number valid')
      elif ph==[0:8] and ph==[0:11]:
      print('Phone Number is Invalid')
      else:
      print('Phone Number is Invalid')

  • @pranitaathawale3225
    @pranitaathawale3225 2 года назад +1

    Hey Harry,
    your videos are really very good
    here is the excersie
    print("enter first digit")
    num1 = int(input())
    print("enter second digit")
    num2 = int(input())
    print("enter operation")
    operation = input()
    if num1 == 45 and num2 == 3 and operation == "*" :
    print(555)
    if num1 == 56 and num2 == 9 and operation == "+" :
    print(77)
    if num1 == 56 and num2 == 6 and operation == "/" :
    print(4)
    else:
    if operation == '*':
    print(num1 * num2)
    if operation == '/':
    print(num1 / num2)
    if operation == '+':
    print(num1 + num2)
    if operation == '-':
    print(num1 - num2)

  • @kumailnaqvi5
    @kumailnaqvi5 2 года назад

    I have done a BS in 2013 since then I did administrator jobs but then I realized that the future is only in programming in which I can easily work with peace, also I am learning blockchain development which is also in python but on udemy the person who is instructor guided about fundamentals of python and he described python fundamentals which are using in blockchain development also I am watching your videos same time, I just watch and implement blockchain class for almost 2,3hours then watch your video for 1 or 2 hours with practice, never hesitate in learning something new, its never too late.
    D1={1:"Addition", 2:"Subtraction", 3:"Multiplication", 4:"Division"}
    print("Enter your first number")
    N1 = int(input())
    print("Enter your second number")
    N2=int(input())
    print("Enter your operator")
    print("Press 1 for Addition, Press 2 for Subtraction, press 3 for Multiplication, press 4 for Division")
    D5= int(input())
    testy= (D1[D5])
    if testy== "Multiplication" and N1==45 or N1==3 and N2==45 or N2==3:
    print("Your result is 555")
    elif testy=="Multiplication":
    print("Your result is ", N1*N2)
    if testy == "Addition" and N1 == 56 or N1 == 9 and N2 == 9 or N2 == 56:
    print("Your result is 77")
    elif testy=="Addition":
    print("Your result is ", N1+N2)
    if testy=="Division" and N1==56 and N2==6 or N1==6 and N2==56:
    print("Your result is 4")
    elif testy=="Division":
    print("Your result is ", N1/N2)
    if testy=="Subtraction":
    print(N1-N2)

    • @manojrudra6007
      @manojrudra6007 Год назад

      really motivating me, I did b-tech in IT 2015, I am currently working as IT Recruiter, l do want to learn programing but teachers of programing were not good, it take a long time, but now I m learning, let see what happen.

  • @thechotadevloper5164
    @thechotadevloper5164 4 года назад +5

    print("1 : addition
    2 : substration
    3 : multification
    4 : division")
    inp=int(input("Enter your choise for operation : "))
    a=int(input("enter value for a : "))
    b=int(input("enter value for b : "))
    if inp==1:
    if a==56 and b==9:
    print("your addition is : ",77)
    else:
    print("your addition is : ",a+b)
    elif inp==2:
    print('your substration is : ',a-b)
    elif inp==3:
    if a==45 and b==3:
    print("your multification is : ",555)
    else:
    print("your multification is : ",a*b)
    elif inp==4:
    if a==56 and b==6:
    print("your division is : ",4)
    else:
    print("your division is : ",a/2)
    else:
    print("wrong choise.......")

  • @moulavb3932
    @moulavb3932 5 лет назад +10

    elif 56 + 9!=77 and oprator=="+":
    sub=num+num2
    print(sub)

  • @rehanazeem5694
    @rehanazeem5694 2 года назад

    #LOVE YOU HARRY BHAI FROM PAKISTAN!
    #KEEP WORKING LIKE THAT, MAY YOU PROSPER MORE!
    sum = int(input("Enter num1 to sum: ")) + int(input("Enter num2 to sum: "))
    if (sum==56+9):
    print(77)
    else:
    print("Sum is:",sum)
    diff = int(input("Enter num1 to differ: ")) - int(input("Enter num2 to differ: "))
    print("Difference is:",diff)
    pro = int(input("Enter num1 to product: ")) * int(input("Enter num2 to product: "))
    if (pro==45*3):
    print(555)
    else:
    print("Product is:",pro)
    div = int(input("Enter num1 to divide: ")) / int(input("Enter num2 to divide: "))
    if (div==56/6):
    print(4)
    else:
    print("Answer is:",div)

  • @sunotoapnedilki2100
    @sunotoapnedilki2100 4 года назад +8

    """This is faulty calculator. so this will some opretion perfome wrong like that 45*3=555, or 56+9= 77 or 56/6=4 or 55-5=60.
    after that if you use apart form these value so this calculator will give corrcet solution"""
    print("This progaram use for calculator")
    print("what do you want ?
    addtion for press '1'
    subtract for press'2'
    multiply for press '3'
    divide for press '4'")
    z=int(input())
    if z

    • @sunotoapnedilki2100
      @sunotoapnedilki2100 4 года назад

      sir this is my second program . sir plz check my program and feed back me plz sir

  • @ESOTERICEDITZ
    @ESOTERICEDITZ 3 года назад +4

    print ("Operators are:
    1. Addition
    2. Subtraction
    3. Multiplication
    4. Division ")
    opt= input("select An Operator: ")
    opt = int(opt)
    val1 = input("Enter First Number: ")
    val1 = float(val1)
    val2 = input("Enter Second Number: ")
    val2 =float(val2)
    if (opt > 4 or opt

  • @FitnessLoverkanpuriya
    @FitnessLoverkanpuriya 2 года назад +1

    print("welcome to faulty calculator")
    print("enter the frist number")
    num1=(int(input()))
    print("enter the second number")
    num2=(int(input()))
    print("enter the oprator (+,-,*,%,/):")
    operator=str(input())
    if num1==45 and num2==3 and operator=="*":
    print("555")
    elif num1==56 and num2==9 and operator=="+":
    print("77")
    elif num1==56 and num2==6 and operator=="/":
    print("4")
    elif operator=="%":
    print("the moduls of two number:",int(num1)%int(num2))
    elif operator=="+":
    print("the sum of two number:",int(num1)+int(num2))
    elif operator=="-":
    print("the sub of two number:",int(num1)-int(num2))
    elif operator=="*":
    print("the multiplication of two number:",int(num1)*int(num2))
    elif operator=="%":
    print("the modules of two number:",int(num1)%int(num2))
    else:
    print("invlaid operator")

  • @pranavraj5698
    @pranavraj5698 3 года назад +13

    # Exercise 2 - Faulty Calculator
    # 45 * 3 = 555, 56+9 = 77, 56/6 = 4
    # Design a calculator which will correctly solve all the problems except
    # the following ones:
    # 45 * 3 = 555, 56+9 = 77, 56/6 = 4
    # Your program should take operator and the two numbers as input from the user
    # and then return the result
    user_input1 = int(input("Enter your first number: "))
    user_input2 = int(input("Enter your second number: "))
    user_input3 = (input("Enter your operator: +,-,*,/ "))
    if user_input1==45 and user_input2==3 and user_input3=='*':
    print("Your answer is: 555")
    elif user_input1==56 and user_input2==6 and user_input3=='/':
    print("Your answer is: 4")
    elif user_input1==56 and user_input2==9 and user_input3=='+':
    print("Your answer is: 77")
    elif user_input3=='+':
    print("Your answer is: ", user_input1 + user_input2)
    elif user_input3=='-':
    print("Your answer is: ", user_input1 + user_input2)
    elif user_input3=='*':
    print("Your answer is: ", user_input1 * user_input2)
    elif user_input3=='/':
    print("Your answer is: ", user_input1 / user_input2)
    else:
    print("Invalid input try again!!")

    • @subhadeepmandal3092
      @subhadeepmandal3092 3 года назад +2

      you have given addition where it should be subtraction in second case

    • @omlahiri3415
      @omlahiri3415 3 года назад +1

      Your coding skills is very goog ❤️🙏

    • @gauravkataria6409
      @gauravkataria6409 3 года назад +1

      Agar user n input 1 m 3 de deya or input 2 m 45 de deya to bhai tera code glt ho jayega

    • @pranavraj5698
      @pranavraj5698 3 года назад +1

      @@gauravkataria6409 yes you are right I will change the code

    • @pranavraj5698
      @pranavraj5698 3 года назад +1

      @@gauravkataria6409 I am in 8th standard

  • @roshanchauhan1123
    @roshanchauhan1123 2 года назад +6

    madara = int(input("Type 1 for Addition, 2 for Subtraction, 3 for Multiplication, 4 for Division: "))
    a = int(input("Enter your first number: "))
    b = int(input("Enter your second number: "))
    if madara == 1:
    if a == 56 and b == 9:
    print("The sum of the numbers is:", 77)
    else :
    print("The sum of the numbers is:", a+b)
    elif madara == 2:
    print("The difference of the numbers is:", a-b)
    elif madara == 3:
    if a == 45 and b == 3:
    print("The product of the numbers is:", 555)
    else :
    print("The product of the numbers is:", a*b)
    elif madara == 4:
    if a == 56 and b == 6:
    print("The division of the numbers is:", 4)
    else :
    print("The division of the numbers is:", a/b)

    • @shubhamkumar-nw1ui
      @shubhamkumar-nw1ui 2 года назад

      This program will give 56+9=77 but of 9+56 the true value....so i think this needs improvement

  • @arshitthakur1318
    @arshitthakur1318 2 года назад

    print("NOTE- value of first no. should be greater than second")
    x=int(input("enter first number"))
    y=int(input("enter second no."))
    z=int(input("type 1 for addition,2 for substraction,3 for multiplication,4 for division"))
    if x==45 and y==3 and z==3:
    print("555")
    elif x==56 and y==9 and z==1:
    print("77")
    elif x==56 and y==6 and z==4:
    print("4")
    else:
    if z==1:
    print(x+y)
    elif z==2:
    print(x-y)
    elif z==3:
    print(x*y)
    elif z==4:
    print(x/y)
    else:
    print("invalid no.")
    print("thanku harry bhai")

  • @smrutisuruti
    @smrutisuruti 4 года назад +14

    """design a calculator which will correctly solve all the problems except this following ones:-
    1)45*3=555
    2)56+9=77
    3)56/6=4
    Your program should take operator and two numbers as input and then return the result"""
    print("Enter two numbers and a operator to get your result")
    num1 = int(input("enter 1st number"))
    num2 = int(input("enter second number"))
    o = str(input("Enter your method as a(Addition:+),s(Substraction:-), d(Division:/), m(Multiplication:*): "))
    set1=set()
    set1.add("a")
    set1.add("s")
    set1.add("d")
    set1.add("m")
    num3 = num1 + num2
    num4 = num1 - num2
    num5 = num1 * num2
    num6 = num1 / num2
    if num1 == 45 and num2 == 3 and o == "m":
    print("555")
    elif num1 == 56 and num2 == 9 and o == "a":
    print("77")
    elif num1 == 56 and num2 == 4 and o == "d":
    print("4")
    elif num1 == 3 and num2 == 45 and o == "m": #swaping numbers
    print("555")
    elif num1 == 9and num2 == 56 and o == "a":
    print("77")
    elif num1 == 4 and num2 == 56 and o == "d":
    print("4")
    else:
    if "a" in set1:
    print("result", num3)
    elif "s" in set1:
    print("result", num4)
    elif "m" in set1:
    print("result", num5)
    else:
    print("result", num6)

    • @Datapassenger_prashant
      @Datapassenger_prashant 4 года назад

      there is an error : while doing substraction, m, and d, it is adding the values.
      Please check. thank you. :)

  • @aakankshanandre6341
    @aakankshanandre6341 Год назад

    Well started this course now, so here we go..
    a = int(input('Enter first number:'))
    b = int(input('Enter second number:'))
    operator = input('Enter the operator(+,-,*,/):')
    if a ==1011 and b == 3091 and operator == "+":
    print(5201)
    if a == 7991 and b == 981 and operator == "-" :
    print(6551)
    if a== 57 and b == 81 and operator == "*":
    print(12570)
    if a == 7711 and b == 73 and operator == "/":
    print(13)
    else:
    if a!=1011 or b!= 3091 and operator == "+":
    print(a+b)

    if a!=7991 or b!= 981 and operator =="-":
    print (a-b)

    if a!=57 or b!= 81 and operator == "*":
    print (a*b)

    if a!=7711 or b!= 73 and operator == "/":
    print (a/b)

  • @ramaisgod
    @ramaisgod 5 лет назад +5

    # Python Exercise 2 - Faulty Calculator
    #Except 45 * 3 = 555, 56 + 9 = 77, 56/6 = 4
    print("Enter 1st Numnber : ")
    num1 = int(input())
    print("Enter Operator (Like +, -, *, /) : ")
    op = input()
    print("Enter 2nd Numnber : ")
    num2 = int(input())
    L1 = [45, "*", 3]
    L2 = [56, "+", 9]
    L3 = [56, "/", 6]
    result = [num1, op, num2]
    mydict = {"L1":555, "L2":77, "L3":4}
    if result == L1:
    print(mydict["L1"])
    elif result == L2:
    print(mydict["L2"])
    elif result == L3:
    print(mydict["L3"])
    elif op == "+":
    result = num1 + num2
    print(result)
    elif op == "-":
    result = num1 - num2
    print(result)
    elif op == "*":
    result = num1 * num2
    print(result)
    elif op == "/":
    result = num1 / num2
    print(result)
    else:
    print("Pleae check operator")
    # Apka har video mai 4-5 bar dekhta hu aur practice krta hu. HaRRy bhaai aapse ek help chahiye aap comments ka reply v nhi krte ho.. :( . Mujhe python django me ek help chahiye. mai apni query apko kaise batau thodi lambi query hai. @ Please reply

    • @ranmadhav
      @ranmadhav 2 года назад +1

      ye list wala method unique hai 👍

  • @ShraddhanjaliGupta
    @ShraddhanjaliGupta 4 года назад +4

    👍

  • @sahilakhan6314
    @sahilakhan6314 Год назад +1

    Required faulty calculator is ;
    n1=int(input('Enter your first number
    '))
    n2=int(input('Enter your second number
    '))
    operator=input('Choose operator(+-*/)
    ')
    if operator=='+':
    if n1==56 and n2==9:
    print('Sum of both the number is 77')
    else:
    print ('Sum of both the number is', int(n1) +int(n2))
    if operator=='*':
    if n1==45 and n2==3:
    print('Product of both the numbers is 555')
    else:
    print('Product of both the numbers is ', int(n1) *int(n2))
    if operator=='/':
    if n1==56 and n2==6:
    print ('Division of both the numbers is 4')
    else:
    print('Division of both the numbers is', int(n1) /int(n2))
    elif operator=='-':
    print('Difference of both the numbers is', int(n1) -int(n2))

  • @prashantmajumdar1519
    @prashantmajumdar1519 5 лет назад +4

    Are Bhai beginning me hi itna hard exercise Kyu de dia samajh nhi ara kaise banau

    • @anandzacharia9395
      @anandzacharia9395 3 года назад

      For those who not able to do the exercise
      print("number 1: ")
      num1 = int(input())
      print("oprator: ")
      op = input()
      print("number 2: ")
      num2 = int(input())
      if op == "+":
      if num1 == 56 and num2 == 9:
      print(77)
      else:
      ans = num1 + num2
      print(ans)
      elif op == "-":
      ans = num1 - num2
      print(ans)
      elif op == "*":
      if num1 == 45 and num2 == 3:
      print(555)
      else:
      ans = num1 * num2
      print(ans)
      elif op == "/":
      if num1 == 56 and num2 == 6:
      print(4)
      else:
      ans = num1 / num2
      print(ans)
      else:
      print("Please enter valid input")
      thank me later

  • @shubham_wankhede2570
    @shubham_wankhede2570 2 года назад +15

    I AM IN 9th CLASS BUT LEARN PROGRAMMING

    • @vivan_sharma_15
      @vivan_sharma_15 Год назад

      Me too.

    • @anjaliraghav9824
      @anjaliraghav9824 Год назад +2

      Me too

    • @mranonymous2944
      @mranonymous2944 Год назад +2

      You have enough time bro to do bczz 9th syllabus is not too much . I am in 11th and learning this czz i take computer as 5th sub with pcm 🥵. You are learning it now it will be beneficial for you !!!

    • @pratimaadhikari453
      @pratimaadhikari453 Год назад +2

      I am in 7th class but my complete to learn frontend development with this language HTML, CSS, JavaScript and back end language we know more one c++ and now since I am reading in 7th class I am learn python interpreted language.

    • @shardulprogrammer
      @shardulprogrammer Год назад

      I also

  • @avnishpathak1510
    @avnishpathak1510 7 месяцев назад

    Brother I know I am pretty late
    but I have written the code
    # developing a faulty calculator
    i1 = input("Enter your name- ")
    print("Greetings!", i1)
    # taking inputs
    a = int(input("Enter your first number-"))
    b = int(input("Enter your second number-"))
    d1 = {1: "(+)", 2: "(-)", 3: "(*)", 4: "(/)", 5: "(**)"}
    i2 = int(input('''Select an operation

    Press 1 for addition
    Press 2 for subtraction
    Press 3 for multiplication
    Press 4 for division
    Press 5 for exponentiation- '''))
    if (a, b) == (45, 3) and i2 == 3:
    print("The operator-", d1[3])
    print("The answer is- 555")
    elif (a, b) == (56, 9) and i2 == 1:
    print("The operator-", d1[1])
    print("The answer is- 77")
    elif (a, b) == (56, 6) and i2 == 4:
    print("The operator-", d1[4])
    print("The answer is- 4")
    else:
    if i2 == 1:
    print("The operator-", d1[1], end="
    ")
    print("The answer is- ", a+b)
    elif i2 == 2:
    print("The operator-", d1[2], end="
    ")
    print("The answer is- ", a-b)
    elif i2 == 3:
    print("The operator-", d1[3], end="
    ")
    print("The answer is- ", a*b)
    elif i2 == 4:
    print("The operator-", d1[4], end="
    ")
    print("The answer is-", a/b)
    elif i2 == 5:
    print("The operator-", d1[5], end="
    ")
    print("The answer is-", a**b)
    else:
    print("Please provide an operator.")
    print("Thank You!")