Re: A newbie quesiton: local variable in a nested funciton

2015-12-26 Thread Chris Angelico
On Sun, Dec 27, 2015 at 3:11 PM, wrote: > Last night I noticed that Python does not resolve name in "def" during > import, as C does in the compile/link stage, it was deferred until it was > referenced (i.e. codes was executed). That's OK for Anyway codes has to be > debugged sooner or later.

Re: A newbie quesiton: local variable in a nested funciton

2015-12-26 Thread Chris Angelico
On Sun, Dec 27, 2015 at 3:05 PM, wrote: >> Python's flexibility and simplicity are a huge part of why I love the >> language so much. > > simplicity? Maybe because you are s familiar with Python. It's not to me, > at least at this moment. Please see my next question follows. > I define "sim

Re: A newbie quesiton: local variable in a nested funciton

2015-12-26 Thread jfong
Last night I noticed that Python does not resolve name in "def" during import, as C does in the compile/link stage, it was deferred until it was referenced (i.e. codes was executed). That's OK for Anyway codes has to be debugged sooner or later. I just have to get used to this style. But check

Re: A newbie quesiton: local variable in a nested funciton

2015-12-26 Thread jfong
Chris Angelico at 2015/12/26 UTC+8 5:50:07PM wrote: > 11: Another normal assignment, because otherwise the rest of the work > is pointless. :) Thanks for this detailed example. As I had learned so far, Python really take "name" seriously, and every meaningful result you got have to assign to a n

Re: Importing constantly changing variables

2015-12-26 Thread Ben Finney
ariklapid.s...@gmail.com writes: > Hello everyone ! > First of all, excuse me for my horrible English. As is often the case with people who make this apology, your English is far better than most native English speakers can use any other language :-) > A file named "sensors.py" imports varying v

Re: please can i get help on this problem

2015-12-26 Thread Ben Finney
Prince Udoka writes: > sir does this make sense: Referring to the whole of a community as “sir” is not only too formal, it also betrays a different error: you seem to think you're in a one-on-one dialogue devoted to your issues. Please, instead of trying to make your messages more polite (your

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-26 Thread Cameron Simpson
On 26Dec2015 03:23, princeud...@gmail.com wrote: this is what i finally got, i give-up, some-one, any body pls help: def manipulate_data(list_data, set_data): if list_data == ["apples", "orange", "mangoes"]: for set_data in reversed(set_data): return set_data elif manipul

Re: Importing constantly changing variables

2015-12-26 Thread Ian Kelly
On Sat, Dec 26, 2015 at 8:14 AM, wrote: > As you can see, I want the program to print all values each 5 seconds. > When I run the file "main.py" it does print values every 5 seconds, BUT when > I manually change > the values (e.g. airTemperture = 30 instead of 24) and save the file, nothing > c

Importing constantly changing variables

2015-12-26 Thread ariklapid . swim
Hello everyone ! First of all, excuse me for my horrible English. I am an electronics engineering student, trying to use raspberry pi for one of my projects. Meanwhile, my goal is simply to create a pair of files, written in python, which would do the following: A file named "sensors.py" import

Re: please can i get help on this problem

2015-12-26 Thread Prince Udoka
sir does this make sense: def manipulate_data(item, fruits): if item == ["apples", "oranges", "mangoes", "grapes"]: for fruits in reversed(item): return item elif item == {"apples", "oranges", "mangoes", "grapes"}: for fruits in item: fruits.append("A

Re: please can i get help on this problem

2015-12-26 Thread Prince Udoka
gud day sir, please i have an assignment, nd i am just 2weeks in python; i tried the code i uploaded but its nt working plz help, i need guidiance -- https://mail.python.org/mailman/listinfo/python-list

Re: please can i get help on this problem

2015-12-26 Thread Ben Finney
Please help us by choosing a descriptive Subject field. The one you've chosen tells us *nothing* useful. As it turns out, I can't get anything useful from your message either: Prince Udoka writes: > here is my work, but i dont know what i ave done wrong: Neither do I. What is confusing you, in

please can i get help on this problem

2015-12-26 Thread Prince Udoka
Create a function manipulate_data that does the following Accepts as the first parameter a string specifying the data structure to be used "list", "set" or "dictionary" Accepts as the second parameter the data to be manipulated based on the data structure specified e.g [1, 4, 9, 16, 25] for a lis

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-26 Thread princeudo52
this is what i finally got, i give-up, some-one, any body pls help: def manipulate_data(list_data, set_data): if list_data == ["apples", "orange", "mangoes"]: for set_data in reversed(set_data): return set_data elif manipulate_data(list_data == {"apples", "orange", "mang

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-26 Thread princeudo52
@ cameron, are u sure this solution u gave me works here is what i am getting, i am really having headache, some-one should please have mercy: def manipulate_data(list_data, set_data): if list_data == ["apples", "orange", "mangoes"]: for i in reversed(set_data): return i

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-26 Thread princeudo52
i am really enjoying u guyz, i didnt sleep yesterday night, but all is working out well now: i am 2weeks old in python, thanks you all for the assistance -- https://mail.python.org/mailman/listinfo/python-list

Re: A newbie quesiton: local variable in a nested funciton

2015-12-26 Thread Chris Angelico
On Sat, Dec 26, 2015 at 8:07 PM, wrote: > Thank you for the explanation. It reminds me to dig out something which seems > I had been read before. It's about nested scope in the book "Learning Python" > by Mark Lutz. > > "An assignment (X = value) creates or changes the name X in the current lo

Re: A newbie quesiton: local variable in a nested funciton

2015-12-26 Thread Ben Finney
jf...@ms4.hinet.net writes: > Thank you, Ben. It's amazing that you seem to know every piece of > Python information hiding in the web:-) You're welcome, I'm glad to help. As for the “hiding”, the answer is in the Python documentation itself. > see this question listed in python core language's

Re: A newbie quesiton: local variable in a nested funciton

2015-12-26 Thread jfong
Chris Angelico at 2015/12/26 UTC+8 11:44:21AM wrote: > Pike is semantically very similar to Python, but it uses C-like > variable scoping. Here's an equivalent, which might help with > comprehension: > > function outerf() > { > int counter = 55; > void innerf() > { > write("%d

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-26 Thread malitician
On Thursday, December 24, 2015 at 9:58:54 PM UTC+1, Tim Chase wrote: > On 2015-12-24 11:36, malitic...@gmail.com wrote: > > it is a homework, but we are to figure out the solution first , all > > we need is some guidance please and not to be spoon fed like many > > thought > > Ah, with the intend

Re: A newbie quesiton: local variable in a nested funciton

2015-12-26 Thread jfong
Ben Finney at 2015/12/26 UTC+8 11:42:08AM wrote: > The Python FAQ answers this, even using an example the same as yours > https://docs.python.org/3/faq/programming.html#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value>. > Thank you, Ben. It's amazing that you seem to know every

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-26 Thread malitician
On Saturday, December 26, 2015 at 3:04:45 AM UTC+1, princ...@gmail.com wrote: > #i have worked over 2hours only to get this: some-one help please > manipulate_data = [] > item = {"apples": 23, "oranges": 15, "mangoes": 3, "grapes": 45} > manipulate_data.append(item) > for i in reversed(manipulate_