Reputation: 2 Apprentice
- Active Posts:
- 28 (0.02 per day)
- 07-October 11
- Profile Views:
- Last Active:
- Mar 31 2013 04:55 PM
- OS Preference:
- Favorite Browser:
- Favorite Processor:
- Favorite Gaming Platform:
- Your Car:
- Who Cares
- Dream Kudos:
Posts I've Made
Posted 30 Mar 2013Well, I don't really know Java, but nonetheless I guarantee that the way you are trying to justify things is grossly overcomplicating them.
raw_input is a function. It will print the string argument it is passed and then wait for a user input. The string argument you pass it is not part of the return value.
a = raw_input("Input whatever: ")will assign the return value of the raw_input function to a. a couldn't care less what string you passed to raw_input.
As for your functions you wrote at the end, they don't work because variables defined in functions are local. You need to return values from functions.
Pretty much the way you did it originally is probably what you want though:
a = raw_input("Enter a string: ") print (a)a now holds the value of the raw_input (what the user typed; not the string you passed to raw_input) and you also printed a to the screen (which seems redundant as the user just typed it). What about this isn't what you want?
I seem to over complicate lots of things
It isn't what I want I'm just trying to understand the syntax... So now that you have confirmed that the variable is local.... how do I make a variable that isn't local that I could use in another defined function? Could do something like this:
#a would be a local variable (i know this is wrong its just an example) String a b = raw_input("enter a string") a = b print(B)/>/>/>
I don't know what the "/>" is about after
print(B)/>/>i have deleted it several times in the edit option and then re-posted but it keeps appearing.
Does that make sense?
ok this is weird and annoying /> keeps showing up in my posts and i don't know why after deleting them and submitting the modified post they still exist
- Member Title:
- New D.I.C Head
- 20 years old
- December 1, 1994
- Computer, and more computers.
- Full Name: