I have just started with Python, from the book Python For you and me!
Some basic guidelines I have jotted down. The first program to print the “Hello World !”
print ("Hello World!") = Hello World !
While writing this above code, we write it into a source file. We can use any text editor. For example:
#!/usr/bin/env python print ("Hello World!")
On the first line, we use (
#!), which is called she-bang. In python, this indicates that it should be running the code. The lines of text in python is called “strings”.
Whitespace at the beginning of a line is known as indentation, but if we use the wrong indentation it shows an error.
Basic Rules For Indentation!
- Use 4 spaces for indentation.
- Never mix tabs and spaces.
- One blank line between functions.
- Two blank lines between classes.
Always give a space after # and then start writing commands.