Reputation: 195
i want to store looped data from a returned function into separate variables. here is my code Please correct me if wrong
function:
def rawi():
a = raw_input("enter value of a")
b = raw_input("enter value of b")
return a, b
#calling the above function:
c = rawi()
for i in c:
print i
my desired output should be like : variable1 should have the value returned from a variable2 should have the value returned from b
thank
Upvotes: 0
Views: 77
Reputation: 345
Your function should look like this if you'll loop through c:
def rawi():
a = raw_input("enter value of a")
b = raw_input("enter value of b")
return (a, b) #you can return tuple/list/whatever that stores multiple variables
Upvotes: -1
Reputation: 309841
do you mean something like the following?
variable1, variable2 = rawi()
Upvotes: 5