It looks like first is "<function first at 0x7f5bd2fbcb90>" instead of "h" WHAT DOES THIS MEAN?


#1

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
print original
word = original.lower()
def first():
return word[0]

else:
print 'empty'

THIS IS MY CODE I HAVE HAD A FEW STRUGGLES WITH THE WORD VARIABLE.

PLEASE COULD SOMEONE EXPLAIN HOW I CREATE THE WORD VARIABLE AND COMPLETE THE CODE


#2

Hi why did you add a function?


#3

I tried just saying
word = original.lower()
first = word[0]
but it didn't work and when I ran the code it kept saying define so I thought i'd use the def function


#4

can you post your new code?


#5

https://www.codecademy.com/en/courses/python-beginner-2W5v7/1/2?curriculum_id=4f89dab3d788890003000096#

pyg = 'ay'

original = raw_input('Enter a word:')
if len(original) > 0 and original.isalpha():
print original
word = original.lower()
def first():
return word[0]

else:
print 'empty'`

`


#6

you don't need of the function do the other way..


#7

okay thank you very much for the help !!


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.