0% found this document useful (0 votes)
7 views3 pages

Python Documentation-Part01

The document explains the basic structure of Python code, highlighting that it does not require a main function, semicolons, or brackets for loops and conditionals. Instead, Python uses indentation to define blocks of code and does not require explicit data type declarations for variables. The author emphasizes the simplicity of Python compared to languages like C and Java, encouraging readers to observe and understand the structure without getting bogged down in the details.

Uploaded by

Amtaz Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Python Documentation-Part01

The document explains the basic structure of Python code, highlighting that it does not require a main function, semicolons, or brackets for loops and conditionals. Instead, Python uses indentation to define blocks of code and does not require explicit data type declarations for variables. The author emphasizes the simplicity of Python compared to languages like C and Java, encouraging readers to observe and understand the structure without getting bogged down in the details.

Uploaded by

Amtaz Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Basic Structure:

Output:

Get confused ? don’t worry about the code if you don’t understand what is going there. Just observe the code and it’s
structure closely.
⚫ Does it have any primary function like C/C++/Java?
⚫ Does it end with ";"?
⚫ Does it have any brackets ?
⚫ Does the variables has any predefined data types?

No, for sake of simplify, We don’t need any main function in a python file. We can start coding
directly just like plug & play (Create file & code).

Also, notice that python don’t have any ending notation at each line like C or Java. We don’t need
to put any special character to mark it as end of command/instruction/statement. Python look for
“Enter”(keyboard enter key pressed) as a mark of end of command/instruction/statement. That
means, every command/instruction/statement ends with “Enter”

Python don’t use any brackets for loops and conditional statements/commands. Instead of
brackets, python use indentation(keyboard tab key pressed). That’s mean we need to use indentation
those places where we used to use brackets in C or java.

Python is so smart that he doesn’t need any declaration for data types. Just make a variable and
assign any data(string, integer, float, boolean) you want to set.

That’s it you have now get the basic of basic idea about python file structure. Now, let’s jump into
deeper structure. Don’t worry I am here, I Will explain everything line by line like ChatGpt (Actually
better that him :D)
This how we will write actual code later. Isn’t it easier than Java and C ? of course it is. We are creating
class, objects constructors, user defined function and main function in a same file with this little code !
Once again notice the indentation again.

You might also like