Skip to content

Commit

Permalink
adding scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
srobb1 committed Aug 29, 2017
1 parent 8e8f567 commit b98c3bc
Show file tree
Hide file tree
Showing 16 changed files with 115 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/break.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/python3

count = 0
while count < 5:
print("count:" , count)
count+=1
if count == 3:
break
print("Done")

11 changes: 11 additions & 0 deletions scripts/continue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/python3

count = 0
while count < 5:
print("count:" , count)
count+=1
if count == 3:
continue
print("line after our continue")
print("Done")

5 changes: 5 additions & 0 deletions scripts/file_for.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/python3

file_object = open("../files/seq.nt.fa","r")
for line in file_object:
print(line)
6 changes: 6 additions & 0 deletions scripts/file_for_rstrip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/python3

file_object = open("../files/seq.nt.fa","r")
for line in file_object:
line = line.rstrip()
print(line)
17 changes: 17 additions & 0 deletions scripts/file_read_write.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/python3

seq_read = open("../files/seq.nt.fa","r")
seq_write = open("../nt.counts.txt","w")

total_nts = 0
for line in seq_read:
line = line.rstrip()
nt_count = len(line)
total_nts += nt_count
seq_write.write(str(nt_count) + "\n")

seq_write.write("Total: " + str(total_nts))

seq_read.close()
seq_write.close()

10 changes: 10 additions & 0 deletions scripts/file_write.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/python3

fo = open("../files/writing.txt" , "w")
fo.write("One line.\n")
fo.write("2nd line.\n")
fo.write("3rd line" + " has extra text\n")
some_var = 5
fo.write("4th line has " + str(some_var) + " words\n")
fo.close()

5 changes: 5 additions & 0 deletions scripts/for_string.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/python3

dna = 'GTACCTTGATTTCGTATTCTGAGAGGCTGCTGCTTAGCGGTAGCCCCTTGGTTTCCGTGGCAACGGAAAA'
for nt in dna:
print(nt)
6 changes: 6 additions & 0 deletions scripts/infinit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/python3

count = 0
while count < 5:
print("count:" , count)
print("Done")
11 changes: 11 additions & 0 deletions scripts/list_else.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/python3

numbers = [2,11,33,55,39,55,75,37,21,23,41,13]


for num in numbers:
if num%2 == 0:
print ('the list contains an even number')
break
else:
print ('the list doesnot contain even number')
5 changes: 5 additions & 0 deletions scripts/list_numbers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/python3

numbers = [0,1,2,3,4]
for num in numbers:
print(num)
4 changes: 4 additions & 0 deletions scripts/list_range.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/python3

for num in range(5):
print(num)
4 changes: 4 additions & 0 deletions scripts/list_words.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/python3
words = ['zero','one','two','three','four']
for word in words:
print(word)
2 changes: 2 additions & 0 deletions scripts/nt.counts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
4
Total: 4
1 change: 1 addition & 0 deletions scripts/test.nt.fa
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ACAA
8 changes: 8 additions & 0 deletions scripts/while.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/python3

count = 0
while count < 5:
print("count:" , count)
count+=1
print("Done")

10 changes: 10 additions & 0 deletions scripts/while_else.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/python3

count = 0
while count < 5:
print("count:" , count)
count+=1
else:
print("count:", count, "is now not less than 5")
print("Done")

0 comments on commit b98c3bc

Please sign in to comment.