0

I don't know if I can't find my problem, or I'm just getting my keywords wrong when searching for a solution, but I can't solve it.

I'm getting problems with adding values to lists, here is my code:

x=[]
a=raw_input ("Hello, add your first database entery")
b=raw_input ("Hello, add your second database entery")
c=raw_input ("Hello, add your third database entery")
d=raw_input ("Hello, add your fourth database entery")
x.append(a)
x.append(b)
x.append(c)
x.append(d)
print (x)

Upon entering; 1,2,3,4 for the questions, I get this output:

What's with the u'x' I'm getting?

Edited by georgeoshardo: n/a

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by pyTony
0

Sorry, I didn't phrase it correctly. I'd just like to stop showing the 'u' before each value in the list. Thanks :)

0

Why you do not print each value in list or join list values and print the string?

# back port input as raw_input if we run Python2
try:
    input = raw_input
except:
    pass

x = [input ("Hello, add your %s database entery: " % count) for count in ('first', 'second', 'third')]
print(', '.join(x))

Edited by pyTony: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.