Python Forum
Need of return in function if statement inside the function already returns
Thread Rating:
  • 2 Vote(s) - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need of return in function if statement inside the function already returns
#3
Yeah I know that. What I meant is
When I run below code
a = (10, 20) 
sum(a) == 20 or a[0] == 20 or a[1] == 20
It gives the answer as
True
or
False
That means it returns something.
SO when I make this as a function, why do I have to type return before
sum(a) == 20 or a[0] == 20 or a[1] == 20
this, since it itself is returning the answer
Reply


Messages In This Thread
RE: Need of return in function if statement inside the function already returns - by Athul - Aug-06-2018, 01:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Use of function/return Paulman 6 2,484 Oct-24-2021, 11:07 PM
Last Post: Paulman
  Multiple return from function Grimmar 7 3,723 Mar-22-2021, 09:20 PM
Last Post: Grimmar
  GCF function w recursion and helper function(how do i fix this Recursion Error) hhydration 3 2,629 Oct-05-2020, 07:47 PM
Last Post: deanhystad
  Lambda function not return value mbilalshafiq 4 3,426 Jul-04-2020, 07:47 AM
Last Post: ndc85430
  Child class function of Log return "None" mbilalshafiq 2 2,306 Jun-30-2020, 07:22 PM
Last Post: mbilalshafiq
  Question on "define function"; difference between return and print extricate 10 4,882 Jun-09-2020, 08:56 PM
Last Post: jefsummers
  [split] problem with function return value ops 1 3,449 Apr-13-2020, 01:48 PM
Last Post: buran
  Function to return today's month, day, and year sbabu 9 5,113 Jan-28-2020, 06:20 PM
Last Post: snippsat
  Passing a function to another function yulfmd1802 3 2,317 Jan-23-2020, 09:13 AM
Last Post: ndc85430
  Adding a sqrt function syntax error and <build-in function sqrt> from tkinter import Kael 0 1,917 Oct-14-2019, 05:51 PM
Last Post: Kael

Forum Jump:

User Panel Messages

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