Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what does yield function do? what is the difference between return and yield?

Answer Posted / siva kumar reddy dandu

Yield function keeps all single return values and return all at a time as a list

Yield and return both are used for returning the values from function.
Generally yield is used with iterators, So yield will keep all the return values of each iterative call and returns final result at the end of call as List where as return can return one value for each function call.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When should you use generator expressions vs. list comprehensions in Python and viceĀ­versa?

864


What is os module will do in python?

979


Can you sort a string in python?

858


What is set () in python?

839


How do we execute python?

887


Write a small code to explain repr() in python ?

866


What are tokens in python?

1003


What is a generator?

903


Write a regular expression that will accept an email id. Use the re module.

890


What is the use of dir() function?

948


What are different ways to create an empty numpy array in python?

907


Do arrays start at 0 in python?

806


What is static in python?

897


How long does it take to learn python?

886


What is Python Decorator?

929