I am trying python and get stuck at syntax. Anyone helps me, please
def the_flying_circus(answer): if answer<5: return True elif answer>5: return False else: return 0 print the_flying_circus(4) and they said "Oops, try again. Make sure to use at least one boolean operator! " I feel like an idiot when everybody can do but me.
try ans=the_flying_circus(4) print ans
Your function works fine when I try running it in the python translator on codeacademy. Just slide the last print statement to the beginning rather than indenting it.
ya it works for me too
@hail.b3nt are you doing python course right now?
I am @dan815
cool
are u having fun
I sure am!!
i found a good site to get some practice with programming and learning math wanna try the problems there
Sure! Thanks
im still on the first few questions
theyre interesting problems, learning new ways to use python
Wow! There are so many. I'll enjoy this thanks.
some of those questions later on look crazy
solve like 50! become a pro hacker! haha
Lolz
tell me when u get to like question 3
i need to work out my code, its a little blaahh i wanna rewrite it with while loops but dont know how
@dan815
oh we fixed this problem for u already
It didn't work,
you are writing your print command in your function
paste code here
def the_flying_circus(a): if a<5: return True elif a>=5: return False else: return 0 print a(5) print a(7)
what what is a(5)??
that wont do anything
def the_flying_circus(a): if a<5: return True elif a>=5: return False else: return 0 print the_flying_circus(5) print the_flying_circus(7)
python is very particular on indent if you write something in the indent you are saying this is still part of the function
this is the previous lecture, and I passed it, the problem I got stuck is review def greater_less_equal_5(answer): if answer>5: return 1 elif answer<5 : return -1 else: return 0 print greater_less_equal_5(4) print greater_less_equal_5(5) print greater_less_equal_5(6)
okay is there something still wrong with your code?
def the_flying_circus(a): if a<5: return True elif a>=5: return False else: return 0 print the_flying_circus(5) print the_flying_circus(7)
why do u have = in this code then
def the_flying_circus(a): if a<5: return True elif a>5: return False else: return 0 print the_flying_circus(5) print the_flying_circus(7)
try this
I did, still not work
i dont know the specification of your program but if you have a>=5 then the return 0 for else is redundant for all integer inputs
def the_flying_circus(a): if a<5: return True elif a>=5: return False else: return 0 print the_flying_circus(5) print the_flying_circus(7)
no you cannot put print like that
remove the indent
Oops, try again. Your indentation looks a bit off. Check the Hint if you need help!
def the_flying_circus(a): if a<5: return True elif a>=5: return False else: return 0 (no space here)print the_flying_circus(5) print the_flying_circus(7)
File "python", line 4 elif a>=5: ^ IndentationError: unindent does not match any outer indentation level
def the_flying_circus(a): if a<5: return True elif a>5: return False else: return 0 print the_flying_circus(5) print the_flying_circus(7)
copy paste that code exactly
|dw:1389046531409:dw|
Join our real-time social learning platform and learn together with your friends!