Newbie question. Are those different objects ?

2013-12-20 Thread dec135
y = raw_input('Enter a number:')
print type y
y = float(raw_input('Enter a number:'))
print type y

I'm assuming that y is an object. I'm also assuming that the second and the 
first y are different objects because they have different types.
The second time we type print type y, how does the program knows which one of 
the y's it refers to ?  Is the first y object deleted ?
thanks in advance.
-- 
https://mail.python.org/mailman/listinfo/python-list


How can i return more than one value from a function to more than one variable

2013-12-23 Thread dec135
basically what I wanna do is this :

x = 4
y = 7
def switch (z,w):
***this will switch z to w and vice verca***
 c= z
 z=w
 w=c
 print 'Now x =', w, 'and y = ' , z
 return w
x = switch(x,y)

 How am I supposed to do so I can  return also a value to the variable y 
WITHOUT printing 'Now x =', w, 'and y = ' , z   a second time ?

thanks in advance
-- 
https://mail.python.org/mailman/listinfo/python-list