Quotes help make search much faster. Example: "Practice Makes Perfect"

Tuesday, November 27, 2012

Codecademy: "Check Yourself"


#sample solution


#print "Welcome to the English to Pig Latin translator!"

original="";

def check_string(original):
  size = len(original)
  if size != 0:
    print original
  else:
print "empty"

check_string("A string!")
check_string("")

2 comments:

  1. It does not work, it comes up with this: Oops, try again. Oops! Did you accidentally delete the variable called original?

    ReplyDelete
  2. Thanks Chelsea. This happened because the variable "original" was uninitialized in my previous code. I have updated the code above by setting its value to an empty string. It should work now.

    ReplyDelete


This is an example of scrolling text using Javascript.

Popular Posts