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.
Tutorialspoint

Python Help

# 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

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.