Python Forum

Full Version: Wrong output on my code.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello,

this code is giving me some weird output and i dont know why, I want the array to be printed out but in uppercase letters and i dont know how to make that happen correctly, as well as this error

Error:
<built-in method upper of str object at 0x7fc64e9905b0> <built-in method upper of str object at 0x7fc64e8966f8> <built-in method upper of str object at 0x7fc64e9ff5a8> <built-in method upper of str object at 0x7fc64e898af0> <built-in method upper of str object at 0x7fc64e8967a0> <built-in method upper of str object at 0x7fc64e898b30> <built-in method upper of str object at 0x7fc64e8967d8> <built-in method upper of str object at 0x7fc64e9905b0> <built-in method upper of str object at 0x7fc64e898bb0> <built-in method upper of str object at 0x7fc64e896810>
words = ["Algorithm", "Logic", "Filter", "Software", "Network", "Parameters", "Analyze", "Algorithm",
"Functionality", "Viruses"]
for word in range(len(words)):
    x = len(words)
x = ("algorithm")
y = ("logic")
z = ("filter")
a = ("software")
b = ("network")
c = ("parameters")
d = ("analyze")
e = ("algorithm")
f = ("functionallity")
g = ("viruses")
print (x.upper)
print (y.upper)
print (z.upper)
print (a.upper)
print (b.upper)
print (c.upper)
print (d.upper)
print (e.upper)
print (f.upper)
print (g.upper)
x.upper is the method itself, which is what is getting printed. You need to call that method: x.upper(). That will give you the result, which is the string you are expecting.
thanks.