online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
# A list is an ordered collection of elements myList = ["dog", 10, True, 2.5] print("Initial values of list: " + str(myList)) # You can access an element in the list by typing the name of the list # and brackets with the position in between # Positions in lists start at index 0, instead of 1 # So to get the element "dog" from myList, we would type: print("myList[0] = " + myList[0]) # To make it clearer, here's the indexing for the list above # myList -> "dog" 10 True 2.5 # index -> 0 1 2 3 # To add an element to the list, you can use Arithmetic # However there must be brackets around the element when you do this myList = myList + ["cat"] print("myList, with 'cat' added: " + str(myList)) # To remove an element, use the function remove(value) # Here's an example myList.remove(10) print("myList, with 10 removed: " + str(myList)) # Below, try creating your own list # Print out elements in certain positions and try removing the first element # Add an element to the end of your list as well

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue