8000 Initial python code repos · sdevikar/python@868068c · GitHub
[go: up one dir, main page]

Skip to content

Commit 868068c

Browse files
author
sdevikar
committed
Initial python code repos
0 parents  commit 868068c

File tree

5 files changed

+40
-0
lines changed

5 files changed

+40
-0
lines changed

python2/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Collection of small programs to explore Python2 features

python2/helloworld.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
print "Hello world"
2+
print "Hello universe"
3+
print "Hello earth"
4+
print "Hello Michigan"

python2/lists.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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)

python2/var_declaration.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
mystring = "Hello"
2+
print mystring
3+
4+
myint = 10
5+
print myint
6+
7+
myfloat = 20
8+
print myfloat

python3/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Collection of small programs to explore Python3 features

0 commit comments

Comments
 (0)
0