Is there a way to take a tuple as input? or any other input mechanism other than raw_input?
I was just doing the problem number 4 in problem set 2..and for the 3 number of different packages i had to take 3 different user inputs...any way to get it at one go? here is my code http://dpaste.com/hold/563868/
ok just found the answer from python's website.. it is the input function here is the updated version of my code http://dpaste.com/hold/563905/
Do not use input please. It's dangerous, and deprecated, and not supported by later versions. Use raw_input. If you want to take 3 values you can just have it split them up.. line = raw_input('Please enter 3 values separated by spaces: ') value1, value2, value3 = line.split()
To further what polpak said, I think I remember reading that it is not supported because people can potentially input a malicious script... Another option would just be to put raw_input in a limited loop, assign the input to a tuple inside the loop. Polpak's suggestion is better though.
thanks guys... i am gonna change my code now :)
btw why am i not seeing the good answer button in this post ?
now i see it :D
Join our real-time social learning platform and learn together with your friends!