main-program purpose: handles user input and prints information to the console.
()
| 99 | |
| 100 | |
| 101 | def main(): |
| 102 | """ |
| 103 | main-program |
| 104 | purpose: handles user input and prints |
| 105 | information to the console. |
| 106 | """ |
| 107 | |
| 108 | print( |
| 109 | "\nScientific Calculator\n\nFor Example: sin(rad(90)) + 50% * (sqrt(16)) + round(1.42^2)" |
| 110 | + "- 12mod3\n\nEnter quit to exit" |
| 111 | ) |
| 112 | |
| 113 | if sys.version_info.major >= 3: |
| 114 | while True: |
| 115 | k = input("\nWhat is ") |
| 116 | if k == "quit": |
| 117 | break |
| 118 | result(k) |
| 119 | |
| 120 | else: |
| 121 | while True: |
| 122 | k = raw_input("\nWhat is ") |
| 123 | if k == "quit": |
| 124 | break |
| 125 | result(k) |
| 126 | |
| 127 | |
| 128 | if __name__ == "__main__": |