New to coding


#1

I am currently going through the codecademy course learning python. I am not trying to solve a problem, just some info. My current problem is:


def square(n):
  """Returns the square of a number."""
  squared = n ** 2
  print "%d squared is %d." % (n, squared)
  return squared
  
# Call the square function on line 10! Make sure to
# include the number 10 between the parentheses.

square(10)

My question is, on the print line, the “%” are followed by a “d”. In earlier problems i have seen them with “s” and even ": \ ". I am wondering if there is a site or document that can tell me what all these are used for and when im supposed to use each one.

Thanks


#2

If programming was about remembering syntax, computers would have been programming long time ago. But humans are still there, so clearly its not all about remembering.

well, python has official docs:

https://docs.python.org/3/

but usually you are faster off googling something. Google and stackoverflow are you friend, learn how to use them :slight_smile:


#3

https://quizlet.com/14640890/python-terms-flash-cards/

ive been using that


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.