Python Forum
my coding doesn't work plz help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
my coding doesn't work plz help
#4
It is possible to define a function into another function but is pointless in your case. Rid of all these math functions which are doing one thing, to return a calculation result of two values. There is no indentation of elif to if

  if(operation == '+'):
      return num1 + num2
  elif(operation == '-'):
      return num1 - num2
  elif(operation == '*'):
      return num1 * num2
  else:
      return num1 / num2
......

print(calculator())
Also, you call calculator() inside its own code. Use while loop instead.
For now, that's all.

All in all, I'd have a different approach to almost everything.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
my coding doesn't work plz help - by Darbandiman123 - Feb-02-2017, 05:12 PM
RE: my coding doesn't work plz help - by buran - Feb-02-2017, 05:21 PM
RE: my coding doesn't work plz help - by wavic - Feb-03-2017, 09:35 AM
RE: my coding doesn't work plz help - by Ofnuts - Feb-03-2017, 12:51 PM
RE: my coding doesn't work plz help - by wavic - Feb-03-2017, 01:53 PM
RE: my coding doesn't work plz help - by Ofnuts - Feb-03-2017, 05:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Extending list doesn't work as expected mmhmjanssen 2 347 May-09-2024, 05:39 PM
Last Post: Pedroski55
  Why doesn't calling a parent constructor work with arbitrary keyword arguments? PurposefulCoder 4 1,073 Jun-24-2023, 02:14 PM
Last Post: deanhystad
  Why doesn't this code work? What is wrong with path? Melcu54 7 2,059 Jan-29-2023, 06:24 PM
Last Post: Melcu54
  color code doesn't work harryvl 1 1,013 Dec-29-2022, 08:59 PM
Last Post: deanhystad
  client.get_all_tickers() Doesn't work gerald 2 1,836 Jun-16-2022, 07:59 AM
Last Post: gerald
  pip doesn't work after Python upgrade Pavel_47 10 4,528 May-30-2022, 03:31 PM
Last Post: bowlofred
  For Loop Works Fine But Append For Pandas Doesn't Work knight2000 2 2,168 Dec-18-2021, 02:38 AM
Last Post: knight2000
  Class Method to Calculate Age Doesn't Work gdbengo 1 1,813 Oct-30-2021, 11:20 PM
Last Post: Yoriz
  Process doesn't work but Thread work ! mr_byte31 4 2,783 Oct-18-2021, 06:29 PM
Last Post: mr_byte31
  Psycopg2 doesn't work with python2 MedianykEugene 3 3,098 Aug-10-2021, 07:00 AM
Last Post: ndc85430

Forum Jump:

User Panel Messages

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