Professional Documents
Culture Documents
ZZZZ
ZZZZ
if 'True':
print ("True")
else:
print ("false")
if 'true':
print('answer')
print('true')
else:
print('answer')
print('false')
print(' $ ')
print('$$$')
print(' $ ')
print("""this is python""")
print("w\tw")
print(" w w w")
print(" w")
print(" w w w")
print("w\tw")
print("hai");print('hello')
str = input("Enter your input: "); #complex program can be given as input.The
input() function evaluates it.
print "Received input is : ", str
'''
#range() function
#for 1 parameter
for i in range(5):
print i
print '----------'
#for 2 parameters
for i in range(3,6):
print i
print '----------'
#for 3 parameters
for i in range(1,10,2):
print i
print '----------'
#printing backwards
for i in range(0,-10,-2):
print i
print '----------'
#output operations
for i in range(10):
print i,
print
for i in range(1,10):
print i,
print #here print statement without any object enters into new
line
for i in range(10,20):
print i,
print
print '----------'
import sys
write = sys.stdout.write
write('20')
write('05')
print('\nhai \nhello')
print '----------'
#String indices
string='PYTHON TUTORIAL'
print (string[0])
print (string[3])
print (string[6])
print (string[14])
#print(string[15]) #index out of range
print '\n----------'
apples=22
bananas=20
carrots=30
print"I have "+str(apples)+" apples "+str(bananas)+" bananas "+str(carrots)+"
carrots"