click on this because you want 2


SUBMITTED BY: calebmeboi

DATE: Aug. 20, 2022, 3:54 a.m.

FORMAT: Text only

SIZE: 2.2 kB

HITS: 521

  1. take me to ur heart
  2. # same as `import sys` in python
  3. we know the sys and we’re gonna play it
  4. # add function
  5. gonna add num1, num2
  6. when i give my num1 + num2 it will be completely
  7. say goodbye
  8. # multiply function
  9. gonna multiply num1, num2
  10. when i give my num1 * num2 it will be completely
  11. say goodbye
  12. # divide function
  13. gonna divide num1, num2
  14. when i give my num1 / num2 it will be completely
  15. say goodbye
  16. # subtract function
  17. gonna subtract num1, num2
  18. when i give my num1 - num2 it will be completely
  19. say goodbye
  20. # While True loop to keep the calculator going forever until you kill it (^C)
  21. together forever and never to part
  22. # Ask for input
  23. i just wanna tell u how im feeling "\nCalculate:\n"
  24. give input up sys.stdin.readline()
  25. # Split input in a list which looks like: [num1, operator, num2]
  26. give input up input.split()
  27. # Save operator to a variable
  28. give operator up input[1]
  29. # Create a num1 and num2 variable and make them floats
  30. give num1 up to_float(input[0])
  31. give num2 up to_float(input[2])
  32. # check if operator is "+" and if so run the add function and print the result
  33. and if u ask me how im feeling operator is "+"
  34. i just wanna tell u how im feeling add(num1, num2)
  35. say goodbye
  36. # check if operator is "-" and if so run the subtract function and print the result
  37. and if u ask me how im feeling operator is "-"
  38. i just wanna tell u how im feeling subtract(num1, num2)
  39. say goodbye
  40. # check if operator is "/" and if so run the divide function and print the result
  41. and if u ask me how im feeling operator is "/"
  42. i just wanna tell u how im feeling divide(num1, num2)
  43. say goodbye
  44. # check if operator is "*" and if so run the multiply function and print the result
  45. and if u ask me how im feeling operator is "*"
  46. i just wanna tell u how im feeling multiply(num1, num2)
  47. say goodbye
  48. say goodbye
  49. say goodbye

comments powered by Disqus