Pages

Wednesday, November 22, 2017

Python Basics I

PyBasics1
In [1]:
# Hello World in Python
print("Hello World !")
Hello World !
In [2]:
# Check Python version
import sys
print(sys.version)
3.6.3 |Anaconda, Inc.| (default, Oct 13 2017, 12:02:49) 
[GCC 7.2.0]
In [3]:
# Add two constants
3.4 + 5.6
Out[3]:
9.0
In [4]:
# Defining a variable. No need of explicit type specification
a = 1
b = 2.0
c = "Hello"
print(type(a))
print(a)
print(type(b))
print(b)
print(type(c))
print(c)
<class 'int'>
1
<class 'float'>
2.0
<class 'str'>
Hello

No comments:

Post a Comment

SVM on Iris Data - Part 1

iris_svm_1 In [49]: import matplotlib import matplotlib.pyplot as plt % matplot...