LAB01 - Introduction To Python PDF
LAB01 - Introduction To Python PDF
Activity No Score
01 Introduction to Python and Jupyter 30 points
I. Introduction
https://www.anaconda.com/distribution/
II. Examples
1. Hello World
print("Hello, World!")
2. Arrays
>> cars = ["Ford", "Volvo", "BMW"]
>> x = cars[0]
>> x = len(cars)
3. Arithmetic
a= 21
b = 10
c = 0
c = a + b
print "Line 1 - Value of c is ", c
c = a - b
print "Line 2 - Value of c is ", c
c = a * b
print "Line 3 - Value of c is ", c
c = a / b
print "Line 4 - Value of c is ", c
c = a % b
print "Line 5 - Value of c is ", c
a = 2
b = 3
c = a**b
print "Line 6 - Value of c is ", c
a = 10
b = 5
c = a//b
print "Line 7 - Value of c is ", c
4. Conditonal Statements
If else
var1 = 100
if var1:
print "1 - Got a true expression value"
print var1
else:
print "1 - Got a false expression value"
print var1
var2 = 0
if var2:
print "2 - Got a true expression value"
print var2
else:
print "2 - Got a false expression value"
print var2
5. Tuples
III. Problems