Python Forum
Wrong output on my code.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wrong output on my code.
#1
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)
Reply
#2
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.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
thanks.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  No desired output for code. James349 1 973 May-19-2023, 05:43 PM
Last Post: deanhystad
  im not sure what ive done wrong code doesnt run dgizzly 3 1,346 Nov-16-2022, 03:02 AM
Last Post: deanhystad
  what is wrong with my code 53535 4 1,521 Apr-07-2022, 11:37 AM
Last Post: 53535
  What's wrong with my code? NeedHelpPython 4 2,193 Oct-22-2021, 07:59 PM
Last Post: Yoriz
  Help with my code due 11:59 pm, can you tell me where I went wrong and help fix it? shirleylam852 1 2,647 Dec-09-2020, 06:37 AM
Last Post: stranac
  I am getting an incorrect average, and not sure why? What's wrong with my code? shirleylam852 8 4,657 Nov-20-2020, 05:32 AM
Last Post: deanhystad
  Wrong output, something is missing in my codes Julan 5 2,380 Sep-28-2020, 02:34 PM
Last Post: perfringo
  Something is Wrong with my code susmith552 4 3,027 Nov-28-2019, 02:16 AM
Last Post: susmith552
  What is wrong with my code? Than999 1 2,370 Nov-10-2019, 08:59 PM
Last Post: ichabod801
  Code to use output from arduino as input (help) Updownrightleft 0 2,218 Nov-03-2018, 11:04 PM
Last Post: Updownrightleft

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020