Python Forum
How do I print a returned variable calculated in another function?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I print a returned variable calculated in another function?
#4
(Jul-10-2018, 11:26 AM)Prabakaran141 Wrote: you can also declare the variable "yearAt100" globally and access it anywhere in the program,
Using globals is considered bad practise and generally discouraged. Please, don't suggest that and don't use it in your code. And just for completeness - if you do use globals, your function does not need the return statement. But again, don't do that.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
RE: How do I print a returned variable calculated in another function? - by buran - Jul-10-2018, 12:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  print doesnt work in a function ony 2 368 Mar-11-2024, 12:42 PM
Last Post: Pedroski55
  Variable for the value element in the index function?? Learner1 8 744 Jan-20-2024, 09:20 PM
Last Post: Learner1
  How to access values returned from inquirer cspower 6 941 Dec-26-2023, 09:34 PM
Last Post: cspower
  Variable is not defined error when trying to use my custom function code fnafgamer239 4 657 Nov-23-2023, 02:53 PM
Last Post: rob101
  Printing the variable from defined function jws 7 1,468 Sep-03-2023, 03:22 PM
Last Post: deanhystad
  Function parameter not writing to variable Karp 5 1,032 Aug-07-2023, 05:58 PM
Last Post: Karp
  Print variable without '' and spaces arnonim 1 758 Jan-30-2023, 05:23 PM
Last Post: deanhystad
  How to print variables in function? samuelbachorik 3 970 Dec-31-2022, 11:12 PM
Last Post: stevendaprano
  Problem with print variable in print.cell (fpdf) muconi 0 696 Dec-25-2022, 02:24 PM
Last Post: muconi
  How to calculated how many fail in each site(s) in csv files SamLiu 4 1,342 Sep-26-2022, 06:28 AM
Last Post: SamLiu

Forum Jump:

User Panel Messages

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