Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Displaying values
The print function
List basics
22. Summary


Great job!. It's time to wrap things up! Here are some things we learned:

  • print() prints whatever is put inside its parentheses
  • Variables are declared and assigned values using the equality (=) operator.
  • Some basic variable types are: integers, floats, and strings. Strings are put inside single (' ') or double (" ") quotes.
  • You can convert between variable types to string using str().
  • Comments start with #.
  • List definitions require comma-separated elements to be listed inside square brackets:
    invited_guests = ['Mark', 'Hannah', 'Walter']
  • List elements are accessed with square brackets. Indexing starts at 0.
    invited_guests[0] #first element
    invited_guests[0:2] #first and second element
    invited_guests[1:] #all elements except for the first one
  • To get the number of elements in a list, use the len() function:

Alright, it's time for a short quiz!


Click Next exercise to begin the quiz.