UNDERSTANDING PYTHON CODE STRUCTURE

David Bosah - Jun 22 - - Dev Community

Code Structure

This is the arrangement of code in a programming language. it encompasses the use of formatting techniques like whitespace and indentation. The goal of a good structure is reliability and maintainability.

Python code Structures

There are various parameters that are used in describing the Python language. There are basic ones that you must grasp. Let's look at some of them:

Comments:
These are used to make the code easy to understand. They start with "#"

Variables:
They are used to store data or values in your code.

Function:
They are used to exercise a certain function once called. They are either built in function or user defined function.

Data Types
Python Supports lots of built in data types including strings and integers.

Operators:
They are used to perform different operations on data and variables.

Let's Apply these Structures:

#This right here is a comment

#Defining Variables
a=10
y="happy"

#Defining Arithmetic operation
answer= a+8

#Now for functions 
#Examples of built in functions

Print()
Input()

#For user defined functions

Def Applaud (name)
Print("congratulations + name + !")

#Using the function

Applaud ("Meghan")
Enter fullscreen mode Exit fullscreen mode
. . . . . . .