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

Instruction

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:
    len(list_name)

Alright, it's time for a short quiz!

Exercise

Click Next exercise to begin the quiz.