Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
# to write use print
name = "Drew" # assinging variables
number = (5 + 20) # MATH
print name
print number
a=b=c=4.7 # multiple variables
print a
print b
print c
print "1"
d,e,f = 1,"poo", 7
print f
print d
print e
#""\n\n" to skip
print "\n\nskip"
#var = 10
#del var
#print var #(^ makes error)
fork = "SpoonFork"
print "\n"
print fork
print fork[0:5]
print fork *8
print "\n"
ist = [123, "wert"]
lis = [12,"13k", 2345]
print lis
print ist + lis
dict = {}
dict['one'] = "This is one"
dict[2] = "This is two"
tinydict = {'name': 'john','code':6734, 'dept': 'sales'}
print dict['one'] # Prints value for 'one' key
print dict[2] # Prints value for 2 key
print tinydict # Prints complete dictionary
print tinydict.keys() # Prints all the keys
print tinydict.values() # Prints all the values
0
# Hello World program in Python
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 5, 0.1)
y = np.sin(x)
plt.plot(x, y)
plt.show()
##import numpy as np
#import matplotlib.pyplot as plt
#a = np.random.randint(1,100, 5)
#b = np.random.randint(1, 100, 5)
#print a
#print "\n"
#print b
#print "\n"
#3plt.plot(a,b)