How do I enter indented code in a Codecademy's "Ask a question" box?
I’ve tried the little squiggly marks { }
but that didn’t work.
Can someone please explain:
- How I enter code into the “Ask a question” box
- How I enter code into the “Comment” box?
Thank you.
Answer 509bc71d6d816a0200003251
In the comments you can only put plain text, no formatting. But in the questions and answers it’s easy: before typing code, click the {}
button above the editor window:
It’ll insert “backticks” (typing `this`
produces this
). If your code snippet spans across several lines (when you pasted it in from some exercise), select all lines of code, then click the {}
button. That will insert four spaces at the beginning of each line.
Typing
⎵⎵⎵⎵print "hello"
(where ⎵ represents a whitespace) will produce:
print "hello"
You have to put a blank line before and after the indented lines.
Also see this document or this help article.
4 comments
Alex J: Thanks. No doubt you’re constantly improving Codecademy, but why don’t you include something like “About Codecademy” or a FAQ – both are pretty standard at websites – to enable people like me to find and learn the basics of how the website works. At this point it seems I am either forced to ask questions about each specific technical use issue or sift through endless comments, many of which are irrelevant. Or am I missing something? Also, why is the Comment box so tiny and why am I not allowed a preview?
agreed!
Yes. +1000 to this suggestion
FAQ pages exist: http://help.codecademy.com/customer/portal/articles/1421289 Moreover, formatting instructions are directly below the editing window when you submit a forum question: http://is.gd/D6Kd8F The trouble is that people who read all that are a very tiny minority.
Answer 5492016cd3292fcebe0032ce
Someone is just thumbs downing everyone… just to get their’s on top? Really? I never knew some people here are immature.
Answer 537a1fd17c82ca602100021d
Answer 53bb815f9c4e9d939a00002f
console.log("Hello")
for x in students:
results.append(get_average(x))
return average(results)
def get_letter_grade(score):
if score >= 90:
return "A"
elif score >= 80:
return "B"
elif score >= 70:
return "C"
elif score >= 60:
return "D"
else:
return "F"
console.log("I THINK I DID IT")
Answer 517702005a80804f86000a5d
Answer 51d545038c1ccc26dc006830
Answer 51d5c742631fe98c4300d99e
1 comments
I’ll say that in the future. lol
Answer 51ea27ee282ae3eca8001ea1
Answer 5372b9bf631fe9e1220004eb
Answer 5479c5ee631fe9ad8700298d
Answer 54917f72937676bf0b001c87
Answer 54c92de351b8873e91002662
def get_letter_grade(score):
print "Getting grade..."
if score >= 90:
return "A"
elif score >= 80:
return "B"
elif score >= 70:
return "C"
elif score >= 60:
return "D"
else:
return "F"
print get_letter_grade(get_average(lloyd)) def get_letter_grade(score):
print "Getting grade..."
if score >= 90:
return "A"
elif score >= 80:
return "B"
elif score >= 70:
return "C"
elif score >= 60:
return "D"
else:
return "F"
print get_letter_grade(get_average(lloyd))
Answer 55621106e39efec6ac0004ce
Answer 535bdc4d9c4e9dda80000187
1 comments
random! :D
Answer 54acb4eb86f552811c0034d0
Answer 54c92dcd9113cb9e240025b8
def get_letter_grade(score):
print "Getting grade..."
if score >= 90:
return "A"
elif score >= 80:
return "B"
elif score >= 70:
return "C"
elif score >= 60:
return "D"
else:
return "F"
print get_letter_grade(get_average(lloyd))
1 comments
def get_letter_grade(score):
print "Getting grade..."
if score >= 90:
return "A"
elif score >= 80:
return "B"
elif score >= 70:
return "C"
elif score >= 60:
return "D"
else:
return "F"
print get_letter_grade(get_average(lloyd))
Answer 540368bd9c4e9d3a48001af9
Answer 517946df957cf00b1c0033a1
Popular free courses
- Free course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner Friendly4 Lessons - Free course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner Friendly11 Lessons - Free course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner Friendly6 Lessons