1 / 3

Python for Bioinformatics

Python for Bioinformatics. Midterm Redo Solution. 1. Show the output from the following program fragments: (a) for i in range(5): print(i%3) #i%3 is the remainder after dividing i by 3 for d in [3,'.',1,4,1,5]: print( d,end ='')

nibal
Download Presentation

Python for Bioinformatics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Python for Bioinformatics Midterm Redo Solution

  2. 1. Show the output from the following program fragments: (a) for i in range(5): print(i%3) #i%3 is the remainder after dividing i by 3 for d in [3,'.',1,4,1,5]: print(d,end='') # end = '' means all on one line, no separator (c) for i in range(4): print(i*'x') # i*'x' means repeat x i times 0 1 2 3 4 3.1415 ******

  3. 1. Show the output from the following program fragments: (d) print(list('goodbye')) # list(astring) produces a list whose # elements are the characters of astring (f) D = {} D['uno'] = 'one' D['dos'] = 'two' D['tres'] = 'three' D['cuatro'] = 'four' for k in D:print(k,'->',D[k]) ['g','o','o','d','b','y','e'] D = {'uno':'one'} D = {'uno':'one','dos':'two'} D = {'uno':'one','dos':'two','tres':'three'} D = {'uno':'one','dos':'two','tres':'three','quatro':'four} uno -> one dos -> two tres > three quatro -> four

More Related