Why doesn't this work? making new variable from old ones :L


#1



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


Traceback (most recent call last):
File "python", line 5, in
TypeError: 'str' object is not callable

I expected it to store a the first letter of 'original' as 'first'


pyg = 'ay'

original = raw_input('Enter a word:')
original=original.lower()

first = original(0)

if len(original) > 0 and original.isalpha():
    print original
else:
    print 'empty'


#2

here..
first = original(0)

To get single character from a string we use (index operator )[] - bracket notation
You have used parentheses


#3

ahhhh thanks, missed that


#4

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