The Big if... having an issue

my code =

Make sure that the_flying_circus() returns True

def the_flying_circus():
if 100 > 50:
return (‘True’)
elif 50 > 100:
return (‘False’)
3 * 5 + 12 and 88 == 0
return (‘Not sure’)

print the_flying_circus()
print the_flying_circus()
print the_flying_circus()

Its raising error:
the_flying_circus() should return True,
instead it returned: ‘True’


You should just write False and True, without any ’ '.

Thank you bro your the man

You’re welcome, glad if I could help :wink:

print ‘Welcome to the Pig Latin Translator!’

var = raw_input(‘Enter a word:’)

original = raw_input

if len(var) > 0 and .isalpha():
print (var)

invalid syntax?? im expressing in the exact format program said

May I ask what exactly the purpose of this line is?

If you realized it, you can delete it and it should work fine :wink:

i fixed it thanks. Now theres something weird going on. I completed the PygLatin program, on to the next course in all. However, in the field to the right (block box) where the code is run when i enter the “input” it does not visibly add the concatenated strings, but it says congradulations.
My code =

#Last letters of the word
pyg = ‘ay’

#Tieing it all together
new_word = word[1:] + first + pyg

#The users choicen word or string
original = raw_input(‘Enter a word:’)

#The iteration of concatenation
if len(original)>0 and original.isalpha():
word = original.lower()
first = word[0]
print (original)
print (‘empty’)

Also i tried running it on my windows cpu which is I’m using python 3.4 and it raises Namerror: name ‘word’ is not defined… really weird

Well the code is kind of in a mess. :smiley:

shouldn’t be up there.


won’t do much, instead it should print our new word that we created.

So it should actually look like this:

pyg = 'ay'

original = raw_input('Enter a word:')

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

Ok thats a lot cleaner and it accepted it also. Now why is it that it accepted the code in codeacademy shell but my windows python 3.3 is raising the
NameError: name "raw_input’ is not defined

We are using python 2.7 in codeacademy. In python 3.x raw_input doesn’t exist, instead, you have to type str(input()) to make it work

Seriously your the man bro it all worked. I owe you like 10 packs of frozen tofu #ha

Do you know why python accepted the original code which didn’t print out the desired results?

Glad if I could help :smiley:

You don’t owe me anything, just learn Python, ask questions if you don’t understand, have fun (and don’t make fun of my name :stuck_out_tongue_winking_eye: )

LINE 2 error. Im going to feel so silly once someone tells me where I’m going wrong. an “oh”
moment is ensuing.

MyCode =

def cube(number):
return = (number) **

def by_three(number):
if (number) // 3:
return cube + result
return ‘False’

First of all, you don’t need the “=” for the return, so delete that one. And number ** also shouldn’t really do anything, since the computer won’t know to which power you want to calculate with (is it 1,2,3,4…?).

The instruction says:

Make that function return the cube of that number.

Which would mean, 4** 3 or 6** 3, for example.

So let’s edit the second line to:

number **= 3 (same as number = number **3 )

In the second function, there is also an issue with your return.

won’t call the function, but rather trying to add the variable cube and result (which don’t exist :confused: )

Look at the instructions:

if that number is divisible by 3, by_three should call cube(number) and return its result

Try to call the function like in the instructions and return that.

return cube(number)

And the last thing is, that you don’t need ’ ’ at True or False, so edit the last line as well:

return False

Thanks for the response. It took a while and i got it right but with your explanation i now understand why it was wrong. Thanks again

I tried my best to explain it to you :smiley:

I’m really glad that you understood it and corrected your mistakes.

def fizz_count(x):
count = 0
for item in x:
if item == ‘frizz’:
count = count + 1
return count
print fizz_count([‘fizz’, ‘story’, ‘fizz’])

You got a typo here ^^

if item == 'fizz':