8/11 Not working..anyone have something different that works?


#1

Heres what I have :
pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha() word = original.lower() first = word[0]:
print original
else:
print 'empty'


#3

word = original.lower()
first = word[0]

Arent these supposed to be inside the : ?

What you gave me didnt work, maybe these a glitch?


#4

I like my functions best!

def pig_latin():
    word = raw_input("Enter a word please!").lower()
    if (word and word.isalpha()):
        return word[1:] + word[0] + 'ay'
    else:
        print("Empty")

#5

Hello, my code...

pyg = 'ay'
original = raw_input('Enter a word:')
word = original.lower()
word = original
first = original[0]
new_word = original + pyg
if len(original) > 0 and original.isalpha():
    print (new_word)
else:
    print("Empty")

#6
def pig_latin(word):
word = input("Enter a word please!").lower()
if (word and word.isalpha()):
    return word[1:] + word[0] + 'ay'
else:
    print("Empty")

1 argument for pig_latin ?


#7

@olto_oli

Nope, delete that argument and it will work fine, it is 100% self contained in that function I posted earlier.

Here it is again.

def pig_latin():
    word = raw_input("Enter a word please!").lower()
    if (word and word.isalpha()):
        return word[1:] + word[0] + 'ay'
    else:
        print("Empty")

#8

i cant get it to work ethier i need help! we need help!


#9

@zeziba

Ok, sorry, i delete argument and it's ok...


#10

But...
Python 3.x

<< raw_input() was renamed to input(). That is, the new input() function reads a line from sys.stdin and returns it with the trailing newline stripped. It raises EOFError if the input is terminated prematurely. To get the old behavior of input(), use eval(input()) >>
look here...


#11

@olto_oli

I use python 3.4 for my personal projects but codeacademy uses 2.7.5 which still uses the raw_input.


#12

I'd add that Codecademy seems to be using a lot of different minors of 2.7

For instance you get 2.7.2 in the lab, and 2.7.3 on this page

If you are unsure @olto_oli, you can run this code

import sys
print sys.version

#13

Ok thanks,

For that, i use Geany 1.25 for my tests

3.5.0
[GCC 5.2.0]

:wink:


#14

I've been using Atom for a few weeks and I really like it a lot but love Geany also... :smile:


#15

I don't use a text editor I use PyCharm IDE, it is really nice. It has auto-completion, tells you when you didn't reference something correctly, auto-lookup for dependencies if you screwed the pooch. It also supports other languagees also, has an PIP builit in feature and some other fancy stuff.

Also use Liclipes another very well done IDE/editor, also eclipse too. I don't have the link to that one.

There are a lot of other ones that are good-mediocre at best.

My text editor of choice is notepad++.


#16

+1 for PyCharm and NPP!

Did not know of Liclipes, will check it out thanks @zeziba


#18

This is what worked for me.
Had to indent word and first just like print and no colon was needed after .lower() and word[0].
For whatever reason the indentation is not showing up when pasted on here

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
print original
else:
print 'empty'


#21
pyg = 'ay'


original = raw_input('Enter a word:')
if len(original) > 0 and original.isalpha():
    word = original.lower() 
    first = word[0]
else:
    print "nothing"
    
Not working for me I get an indent error on line 10 Q_Q if I delete the else 
statement I complete the lesson, but I need to know what's wrong with my code. I've tried indenting it and removing the indentations have no ideal what I'm doing wrong Q_Q
  


    indent preformatted text by 4 spaces

#23

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
print original
word = original.lower()
first = word[0]
else:
print 'empty'
it displays error in line 6 can i know my error??


#24

I also get an error while the code seems right to me. It says Line 7 (word = original.lower()) IndentationError: expected an indented block.

And the hint says" Did you create a variable called word? -_-

Please help?

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
    print original
else:
    print 'empty'

#27

Is the word supposed to show up with a lowercase letter?

i.e. I type "Coding" and hit enter but it shows as "Coding"?

Isn't it supposed to change to "coding"?