return statement

I have 58 stars, altitudes and bearings
when running the ‘while loop’ all variables are printed.
but not so in the ‘return’ statement
return [(stars),round(Hc,2),round(Az,0)]
output: [‘achernar’, -54.61, 215.0]

print(stars)
print(round(Hc,2))
print(round(Az,0))

input
Day 4
GMT 4
latitude 22
longitude 33

output:
achernar
-45.25
208.0
acrux
3.29
171.0
adara
11.82
232.0
etc.
I need the ‘return’ for TKinter
can you help?

return exits the function/method you are in. if you are in a loop within that function/method, it will break from that loop. In the loop, append the per star data to the list you want to return, and return the list. So take the return outside the loop.

There is nothing special about Tkinter, it can very well work with a list, tuple etc. What issue do you have here?

1 Like

Thank you Menno for your reply. I didn’t realize that Return exits the fuction. I will take your advice, append the star data and then take the return outside the loop.
I’m still quite new to programming ( I’m a retired navigator trying to program).
Tkinter is my next step after I’ve sorted the return problem.
Regards
Sybe Starkenburg

1 Like