Python Forum
Python calculator divide by zero help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python calculator divide by zero help
#2
I think if you put your
def divide(x, y):
    if x == 0 or y == 0:
        print('You cannot divide by Zero')
    else:
        return x / y
you might have more luck.
Reply


Messages In This Thread
Python calculator divide by zero help - by dock1926 - Jan-19-2020, 09:59 PM
RE: Python calculator divide by zero help - by michael1789 - Jan-19-2020, 10:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need some help trying to get my Python mortgage amortization calculator to work prope IamSirAskAlot 4 15,934 Feb-12-2024, 10:53 PM
Last Post: BerniceBerger
  New to python, trying to make a basic calculator AthertonH 2 1,227 Apr-14-2022, 03:33 PM
Last Post: AthertonH
  Divide a number by numbers in a list. Wallen 7 8,292 Feb-12-2022, 01:51 PM
Last Post: deanhystad
  How To Create A "Birthday Calculator" in Python? unigueco9 3 3,943 Oct-11-2021, 08:03 PM
Last Post: SamHobbs
  python calculator only using decomposing functions kirt6405 1 1,833 Jun-19-2021, 12:52 AM
Last Post: bowlofred
  how to divide one big equation entered as a string to small chunks gungurbuz 1 1,688 May-28-2020, 03:46 PM
Last Post: Larz60+
  how to divide array number chinting 5 3,045 Dec-30-2019, 11:29 AM
Last Post: ibreeden
  Python Program to Make a Simple Calculator jack_sparrow007 2 10,346 Oct-19-2018, 08:32 AM
Last Post: volcano63
  Python don't divide SteLu 8 5,418 Dec-21-2017, 02:58 PM
Last Post: casevh
  Creating a Calculator with Python KatherineHov 8 7,945 Aug-03-2017, 02:13 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

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