80 likes | 167 Views
First Program. Open a new Python File Write down the following command : print(“ Hello World ”) Go to Run -> Run As -> Python See the end result. Don’t forget the () and the “ “. This will print a phrase. First Program. Open a new Python File Write down :
E N D
FirstProgram • Open a newPython File • Writedownthefollowingcommand: print(“HelloWorld”) • Go to Run -> Run As -> Python • Seetheendresult Don’tforgetthe() andthe “ “ Thiswill print a phrase
FirstProgram • Open a newPython File • Writedown: print(“HelloWorld”) • Go to Run -> Run As -> Python • Seetheendresult Console: Hello Word
FirstProgram Wewillget: Ifwewrite: print (“HelloWorld”) print (“Helloyear ” +10) Print(“ ThisisPeriod 1”) HelloWorld Helloyear 10 ThisisPeriod 1
Comments Commentsallowyou to writedownthingsthatwillnotbereadbythecompiler. To writecomments: #thisis a onelinecomment “””thisis ablock comment “”
Comments Begineveryprogramwith a commentlikethis “”” Authorofprogram Date Version Explanationofthecode in this file does “””
GoodPractices • Alwaysstart a programwith a commentstatinghowyou are, the date, theversion, andwhatit does • Neverput “;” attheendof a command • Neverhave more than a command in a line • Haveblankspacesbetweendifferntlinesofcode • Commentwhatdifficultpartsofcode do • Save as often as possbible • Thinkbeforewritingthecode. - Alwayshave a pieceofpaperand a pencil to doodlestuff!!!!
BadPractices GoodPractices print (“HelloWorld”) print (“HelloWorld”) print (“HelloWorld”) print (“HelloWorld”) print (“Helloyear ” +10) Print(“ ThisisPeriod 1”) print (“HelloWorld”)print (“HelloWorld”)print (“HelloWorld”)print (“HelloWorld”)print (“Helloyear ” +10)Print(“ ThisisPeriod 1”)