Python 1
Python 1
Goto CMD
Goto the Installation Directory
Ex: C:\Python31\
Type
Python.exe –V (To check version)
Python (To execute python)
IDLE lets you write code in its full-featured code editor
as well as experiment with code at the Python Shell.
You’ll use the code editor later in this book but, when
learning Python, IDLE’s shell really rocks, because it
lets you try out new Python code as you go.
When you first start IDLE, you are presented with the
“triple chevron” prompt (>>>) at which you enter
code. The shell takes your code statement and
immediately executes it for you, displaying any results
produced on screen.
Creating Lists
Len(movies)
◦ Return the Length of List
movies.append(“Fist of Fury”)
◦ Add another Value to End of the List
movies.pop()
◦ Delete the last Item from the List
movies.extend([“Dragon”,”Dear”])
◦ Add another List to an Existing List
movies.remove(“Dragon”)
◦ Remove a specific data item from a List
movies.insert(0,“jungle book”)
◦ Add a data item to a specific location of a List
Lists Cont..
The target identifier is like any other name in your code. As your list is
iterated over, the target identifier is assigned each of the data values in your
list, in turn. This means that each time the loop code executes, the target
identifier refers to a different data value.
An alternative to using for is to code the iteration with a
while loop. Consider these two snippets of Python code,
which perform the same action:
To Check whether it’s a list
Isinstance(listName,list) -> Boolean