File tree Expand file tree Collapse file tree 4 files changed +49
-0
lines changed Expand file tree Collapse file tree 4 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/python3
2+
3+ def main ():
4+ a = 1
5+ b = "Ashwin"
6+ print ("a = {}, b = {}" .format (a , b ))
7+ print ("Type of a is: {}" .format (type (a )))
8+ print ("Type of b is: {}" .format (type (b )))
9+
10+ c = (1 , 2 , 3 , 4 , 5 )
11+ print (c )
12+
13+ d = [1 , 2 , 3 , 4 , 5 ]
14+ print (d )
15+
16+ if __name__ == "__main__" : main ()
Original file line number Diff line number Diff line change 1+ #!/usr/bin/python3
2+
3+ # Single line comments using hash
4+
5+ # This is
6+ # Multi line
7+ # comment using hash per line
Original file line number Diff line number Diff line change 1+ #!/usr/bin/python3
2+
3+ def main ():
4+ a , b = 5 , 10
5+ if a < b :
6+ print ("a({}) is less than b({})" .format (a , b ))
7+ else :
8+ print ("a({}) is not less than b({})" .format (a , b ))
9+
10+ if __name__ == "__main__" : main ()
Original file line number Diff line number Diff line change 1+ #!/usr/bin/python3
2+
3+ # def is used to define a function
4+ # Syntax:
5+ # def <function-name>(<param1>, <param2>, ...):
6+ def main ():
7+ print ("Main function" )
8+ addition (45 , 45 )
9+ addition ()
10+
11+ # a and b are having default values
12+ def addition (a = 5 , b = 5 ):
13+ print ("Addition: " , a + b )
14+
15+
16+ if __name__ == "__main__" : main ()
You can’t perform that action at this time.
0 commit comments