You are on page 1of 1

'''

Day1
Multi line commenting
'''
print "Hello World"#Print statement
#New line character is statement terminator
#DataTypes - Numbers and Strings
a= 125
b= 45.67
c= 12+5j
print a,b,c
type(a)
type(b)
type(c)
#Two types of objects -> Immutable and mutable
#both numbers and strings are immutable
s1 = "Happiest Minds"
s2 = "Bangalore"
#Change Bangalore to Mangalore
##s2[0]='M' #Error
0s2[0:4]
#String Operators
"Sony World"+" Bangalore"
s2*3
#Arithmetic operators
12+5
10/3
20%3
10 ** 3 #( 10 to the power of 3)
s3 = r"C:\Intel\Logs\IntelCPHS.txt"
# r -> take whatever we type as input.
print s3
#Python conversion
a=123
b = str(a)
c = int(b)+345
#formated printing
print "Number1 is %d and Number 2 is %d \n string = %s" %(a,b,s2)
#make sure that a and b are int type and s2 is a string
#Input
name = raw_input("Enter your name : ")
#all inputs will be stored as string data type
numb = float(raw_input("Enter the number : "))
print "The name is " + name + " Contact number is " , numb

You might also like