Introduction To Python (Lab 1)
Introduction To Python (Lab 1)
LAB 1
We have 2 ways, the first one is done by following the next steps:
1. Open Anaconda navigator
2. Go to Jupyter and open it
3. Any time we want to make a new Python project, we do the following
1. Go to File tab => new notebook => Python3
2. To write a new statement click Enter
3. To run your code click Enter + Shift
4. To save your code go to and click on it.
qQuotations
qQuotations (cont.):
qComment:
üWe use # symbol to insert comment in python script.
üNote: we can use the triple double quotation (“ “ “ any thing ” ” ”) as a comment
§ Example
§ Example
qMultiple Assignment:
Numbers
Dictionary
Tuple String
List
§ A tuple is another sequence data type that is similar to the list. A tuple
consists of a number of values separated by commas. Unlike lists, however,
tuples are enclosed within parenthesis.
§ The main difference between lists and tuples are − Lists are enclosed in
square brackets [ ] and their elements and size can be changed, while tuples
are enclosed in parentheses ( ) and cannot be updated. Tuples can be thought
of as read only lists.
Eng. Hadeer Mostafa Lab (1) 20
Introduction to
Data Types and Variables: Tuple Python
§ Dictionary is a sequence data type, each item consists of pair of key and value.
§ Each key is separated from its value by a colon (:), the items are separated by commas,
§ The value of each item can be retrieved by using its key instead of index as list and tuple.