File tree Expand file tree Collapse file tree 5 files changed +40
-0
lines changed
Expand file tree Collapse file tree 5 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ Collection of small programs to explore Python2 features
Original file line number Diff line number Diff line change 1+ print "Hello world"
2+ print "Hello universe"
3+ print "Hello earth"
4+ print "Hello Michigan"
Original file line number Diff line number Diff line change 1+ # Create a simple list
2+ # Also prove that the variables in the list have no fixed type
3+
4+ mylist = ['a' , 'b' , 'c' ]
5+ mylist .append (2 )
6+ mylist .append (4 )
7+ mylist .append (6 )
8+ mylist .append ("swapnil" )
9+ mylist .append (3.4 )
10+
11+ print mylist [0 ]
12+ print mylist [6 ]
13+
14+ print "*****"
15+
16+ for item in mylist :
17+ print item
18+
19+ myname = mylist [6 ]
20+
21+ print "my name is " + myname
22+
23+ numberfloat = 1 + 2 * 3 / 4.0
24+ numberint = 1 + 2 * 3 / 4
25+
26+ print "answer to int calculation is " + str (numberint ) + " and float calculation is " + str (numberfloat )
Original file line number Diff line number Diff line change 1+ mystring = "Hello"
2+ print mystring
3+
4+ myint = 10
5+ print myint
6+
7+ myfloat = 20
8+ print myfloat
Original file line number Diff line number Diff line change 1+ Collection of small programs to explore Python3 features
You can’t perform that action at this time.
0 commit comments