What's new

Closed Line 36 is Wrong, patulong

Status
Not open for further replies.

Quantum Supercomputer

Eternal Poster
Joined
Dec 23, 2017
Posts
740
Reaction
250
Points
339
Age
23
  1. import os
  2. import sys
  3. while True:
  4. print("Rules: ")
  5. print("|First Number")
  6. print("Operator [ + - × ÷ ]")
  7. print("|Second Number")
  8. print()
  9. a = int(input("| "))
  10. operator = input("")
  11. b = int(input("| "))
  12. class Calculator:
  13. def init(obj1,a,b):
  14. obj1.a = a
  15. obj1.b = b
  16. def restart(obj2):
  17. print()
  18. result = input("Enter to Continue || quit this app to exit :)")
  19. os.system("clear")
  20. class Addition(Calculator):
  21. def sum(obj1):
  22. c = a + b
  23. print()
  24. print("= " + str(c))
  25. class Subtraction(Calculator):
  26. def diff(obj1):
  27. c = a - b
  28. print()
  29. print("= " + str(c))
  30. class Multiplication(Calculator):
  31. def pro(obj1):
  32. c = a * b
  33. print(" =" + str(c))
  34. class Division(Calculator):
  35. def quo(obj1):
  36. c = a / b
  37. r = a % b
  38. print(str(c) + " is quotient & " + str(r) + " is the remainder")
  39. if operator == "+":
  40. add = Addition(a,b)
  41. add.sum()
  42. add.restart()
  43. elif operator =="-":
  44. sub = Subtraction(a,b)
  45. sub.diff()
  46. sub.restart()
  47. elif operator =="×" or "x":
  48. mul = Multiplication(a,b)
  49. mul.pro()
  50. mul.restart()
  51. elif operator =="÷" or "/":
  52. div = Division(a,b)
  53. div.quo()
  54. div.restart()
 
36. print("= " + str(c))


Yan lang iba sa mga nauna mong syntax e. Not sure. Nauna ung space bago yung equal sign
 
Status
Not open for further replies.

Similar threads

Back
Top