{"id":67,"date":"2008-05-17T16:20:25","date_gmt":"2008-05-17T21:20:25","guid":{"rendered":"http:\/\/blogs.cae.tntech.edu\/mwr\/python-for-fortran-programmers-chapter-3\/"},"modified":"2008-05-17T16:20:25","modified_gmt":"2008-05-17T21:20:25","slug":"python-for-fortran-programmers-chapter-3","status":"publish","type":"page","link":"https:\/\/sites.tntech.edu\/renfro\/python-for-fortran-programmers\/python-for-fortran-programmers-chapter-3\/","title":{"rendered":"Python for Fortran Programmers &#8211; Chapter 3"},"content":{"rendered":"<p><a href=\"..\/\">See the index page for context<\/a>.<\/p>\n<hr>\n<pre>\n#!\/usr\/bin\/python\n\n# Translation of program \"COMPUT\" (solution 1) from D.M. Etter,\n# _Structured FORTRAN 77 for Engineers and Scientists_, p.93\n\n# This program computes the average of a set of experimental data\n# values.\n\nsum = 0.0\ncount = 0\n\nx = float(raw_input(\"\"))\n\nwhile x!=0.0:\n    sum = sum+x\n    count = count+1\n    x = float(raw_input(\"\"))\n\naverg = sum\/float(count)\n\nprint \"The average is %6.2f\\n\" % (averg)\n\n# Notes:\n#\n# The basics of the while loop and comparison operators can be found\n# in the original Python tutorials, e.g.\n# http:\/\/www.python.org\/doc\/2.5.2\/tut\/node5.html#SECTION005200000000000000000\n#\n# And in Python, indentation is how you indicate a nested block of code. \n<\/pre>\n<hr>\n<pre>\n#!\/usr\/bin\/python\n\n# Translation of program \"ANALYZ\" from D.M. Etter, _Structured FORTRAN\n# 77 for Engineers and Scientists_, p.94\n\n# This program determines maximum and minimum values and the range of\n# values for a set of data values.\n\nx = float(raw_input(\"\"))\n\nmax = x\nmin = x\n\nx = float(raw_input(\"\"))\n\nwhile x!=0.0:\n    if x&gt;max:\n        max = x\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>See the index page for context. #!\/usr\/bin\/python # Translation of program &#8220;COMPUT&#8221; (solution 1) from D.M. Etter, # _Structured FORTRAN 77 for Engineers and Scientists_, p.93 # This program computes the average of a set of experimental data # values. sum = 0.0 count = 0 x = float(raw_input(&#8220;&#8221;)) while x!=0.0: sum = sum+x count &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/sites.tntech.edu\/renfro\/python-for-fortran-programmers\/python-for-fortran-programmers-chapter-3\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Python for Fortran Programmers &#8211; Chapter 3&#8221;<\/span><\/a><\/p>\n","protected":false},"author":87,"featured_media":0,"parent":55,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-67","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/pages\/67","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/users\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/comments?post=67"}],"version-history":[{"count":0,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/pages\/67\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/pages\/55"}],"wp:attachment":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/media?parent=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}