OK, flame suit on, I sure someone can help with this one.
I've written quite a few PRI programs such as graphical Pygame weather stations that have been running a treat for many months but I've always been limited as I have never been able to return any sort of returned value from a function so every one of my functions has to be self contained.
I come from a C background (Arduino, PIC etc)where any declared value can be shared between any function but nothing seems to work in python, and everywhere I've searched doesn't give an understandable answer. Lots of people seem to struggle with this, its so annoying as this is about as basic as it gets.
This is a simple bit of test code to try to figure out what is going on
Code: Select all
value = 0 #declare value result = 0 #declare value def maths(value):# function result = value + 50 print result# this prints 150 showing that 100 has been successfully passed to the function return result maths(100)# call function and pass value of 100 to it print result# print the result, this prints 0 as originally declared and not 150 as printed within the function
What on earth am I doing wrong??