Jump to content

using functions.

- - - - -

  • Please log in to reply
2 replies to this topic

#1
apejam

apejam

    Newbie

  • Members
  • Pip
  • 6 posts
Hello all, back to the boards hoping to gain better insight and understanding that I am not getting in my class.


I have a project where I have to take data from a user and insert that data into 1 of 3 functions based on what the user wants to do.. I could do it.. but the catch is I cannot use global variables.. so how in the hell am i supposed to get data from one function to use in another? It's impossible because they are both local to the function right? I have no idea how this could be done.

My question boils down to, how can I use a user input variable in my program to be used by different functions without making said input variable global?

do I call a function within a function to avoid the global variable issue? is that even possible? etc..

I'm at a loss guys. Point me in the right direction?

thanks

#2
apejam

apejam

    Newbie

  • Members
  • Pip
  • 6 posts
I figured it out guys. You can call a function inside another function as long as that function is defined above it :) hopefully this may help someone else.

#3
Josh1289op

Josh1289op

    Newbie

  • Members
  • Pip
  • 4 posts
I would love to know more. I've recently started a class about 7 weeks ago, working with python. I've got an amazing grade and love staying ahead of the class.

This assignment you speak of sounds far more interesting than the lame assignments we are being assigned.I have this feeling our instructor gives such easy assignments as to prevent students from dropping the course. I can defiantly tell the difference between people who are majoring in Computer Programming or Computer Science and the people who are only looking for an IT degree. One of my main concerns is, this intro to comp programming is using python, every course after this uses C and C#. I really do hope I'm not learning Python for no reason.


Anyways, back to your problem. I know you said you solved it, but I would really enjoying seeing the assignment myself. Could you post it to the forums. I would love to have my own go at it!!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users