Friday 2 November 2012

Python Experience



I found Python is a powerful language and is restricted in the formatting. There are some script format are really different from my experience with other languages like bash scripting, C, and PHP. When executing a script, it looks for the correct indentation. If not, an error message will be generated and exit the script. I think it is due to the format of compound statements. Python uses ":" for any compound statement and there is no closing symbol. In order for the system to recognize the condition block correctly, indentation is really important. Since I usually do indentation on all of my scripts, so it didn't give me lots of trouble.




Here's the final output of my first python script.
It checks the user input and loop until the correct number is provided.



 If you want to test my script, here is the link to download. Don't forget to add execution permission before running. :) Download Me






No comments:

Post a Comment