Need help with 'return' in python - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Need help with 'return' in python (/thread-19675.html) |
Need help with 'return' in python - Leo12143 - Jul-09-2019 Like i say, I need help in python please. RE: Need help with 'return' in python - Yoriz - Jul-09-2019 Help us to help you, show us what the problem with return is, post a minimal code sample (in python code tags) for the specific part your stuck on, explain what you expect to happen and what is actually happening and any errors received in error tags. RE: Need help with 'return' in python - SheeppOSU - Jul-10-2019 If you want an example and how it works here. def add(num1, num2): return num1 + num2 number = add(1, 1) print(number) It return a value from a function as seen above. Another exampleimport random def two_random_numbers(minimum, maximum): num1 = random.randint(minimum, maximum) num2 = random.randint(minimum, maximum) return num1, num2 num1, num2 = two_random_numbers(1, 5) numbers = two_random_numbers(1, 5) print(num1) print(num2) print(numbers) Hope this helps
|