Python Programming Training Certification
Flexible Hours
100 Assignments
Instructor Led online Training
50 LMS Access
24X7 Support
100% Skill Level
Enquire Now
Course Overview
Python is one of the world’s top programming languages used today and Python training has become the most popular training across individuals. Training Basket’s Python Training & Certification course covers basic and advanced Python concepts and how to apply them in real-world applications.Python is a flexible and powerful open-source language that is easy to learn and consists of powerful libraries for data analysis and manipulation. Our Python training course content is curated by experts as per the standard Industry curriculum. The curriculum, coding challenges and real-life problems cover data operations in Python, strings, conditional statements, error handling, shell scripting, web scraping and the commonly used Python web framework Django. Take this Python training and certification course and become job-ready now.
Python Comments
Python Comment is an essential tool for the programmers. Comments are generally used to explain the code. We can easily understand the code if it has a proper explanation. A good programmer must use the comments because in the future anyone wants to modify the code as well as implement the new module; then, it can be done easily.
In the other programming language such as C++, It provides the // for single-lined comment and /*…. */ for multiple-lined comment, but Python provides the single-lined Python comment. To apply the comment in the code we use the hash(#) at the beginning of the statement or code.
Let’s understand the following example.
- # This is the print statement
print(“Hello Python”)
Here we have written comment over the print statement using the hash(#). It will not affect our print statement.
Multiline Python Comment
We must use the hash(#) at the beginning of every line of code to apply the multiline Python comment. Consider the following example.
- # First line of the comment
# Second line of the comment
# Third line of the comment
Example:
- # Variable a holds value 5
# Variable b holds value 10
# Variable c holds sum of a and b
# Print the result
a = 5
b = 10
c = a+b
print(“The sum is:”, c)
Output:
- The sum is: 15
The above code is very readable even the absolute beginners can under that what is happening in each line of the code. This is the advantage of using comments in code.
We can also use the triple quotes (”””) for multiline comment. The triple quotes are also used to string formatting. Consider the following example.
Docstrings Python Comment
The docstring comment is mostly used in the module, function, class or method. It is a documentation Python string. We will explain the class/method in further tutorials.
Example:
- def intro():
“””
This function prints Hello Joseph
“””
print(“Hi Joseph”)
intro()
Output:
- Hello Joseph
We can check a function’s docstring by using the __doc__ attribute.
Generally, four whitespaces are used as the indentation. The amount of indentation depends on user, but it must be consistent throughout that block
- def intro():
“””
This function prints Hello Joseph
“””
print(“Hello Joseph”)
intro.__doc__
Output:
- ‘\n This function prints Hello Joseph\n ‘
Python indentation
Python indentation uses to define the block of the code. The other programming languages such as C, C++, and Java use curly braces {}, whereas Python uses an indentation. Whitespaces are used as indentation in Python.
Indentation uses at the beginning of the code and ends with the unintended line. That same line indentation defines the block of the code (body of a function, loop, etc.)
Generally, four whitespaces are used as the indentation. The amount of indentation depends on user, but it must be consistent throughout that block.
- for i in range(5):
print(i)
if(i == 3):
break
To indicate a block of code we indented each line of the block by the same whitespaces.
Consider the following example.
- dn = int(input(“Enter the number:”))
if(n%2 == 0):
print(“Even Number”)
else:
print(“Odd Number”)print(“Task Complete”)
Output:
- Enter the number: 10
Even Number
Task Complete
The above code, if and else are two separate code blocks. Both code blocks are indented four spaces. The print(“Task Complete”) statement is not indented four whitespaces and it is out of the if-else block.
If the indentation is not used properly, then that will result in IndentationError.
Candidate’s Journey During Our Training Program
Expert’s Advice & Selection of Module
Choosing the right type of module for the training is half the battle & Our Team of experts will help & guide you.
Get Trained
Get Trained & Learn End to End Implementation from our Expert Trainer who are working on the same domain.
Work on Projects
We Do make our student’s work on multiple case studies , scenario based tasks & projects in order to provide real-time exposure to them.
Placements
We have a dedicated placement cell in order to provide placement assistance & relevant interviews to our candididates till selection
Placement Partner