Python Forum
Help with try, except, else finally
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with try, except, else finally
#4
If number_1 and number_2 are actually numbers, then you don't need to wrap the operations in try/except. Only the conversion from string to number can fail until you add division to your calculator.

Why are you limiting your calculator to integers? Why not floats. There's no extra code and a lot more capability.

Why do you force the user enter equations in such an awkward way. I would prefer to enter something like "3 + 4" instead of first having to enter the "+" and then the "3" and finally the "4". By the time I'm finished doing that I already forgot my equation.

Why do you have this?
print('{} + {} = '.format(number_1, number_2))
and this?
print('{} * {} = '.format(number_1, number_2))
Aren't they the same except the "+" or "*"? You made the user enter the operator, why don't you use it here?
Reply


Messages In This Thread
Help with try, except, else finally - by Pytho13 - Mar-21-2021, 04:17 PM
RE: Help with try, except, else finally - by deanhystad - Mar-21-2021, 06:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Am I a retard - else and finally blocks in a try statement RubenF85 6 2,763 Jan-12-2021, 05:56 PM
Last Post: bowlofred
  finally clause Skaperen 6 4,052 Jun-02-2019, 09:02 PM
Last Post: snippsat
  try, except, finally ? microphone_head 3 2,954 Apr-28-2019, 09:36 PM
Last Post: microphone_head

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020