Skip to main content

Write the key features of the Python programming language what are comment How can you add

😀  Write the key features of the Python programming language what are comment How can you add

If you want to learn key features of the Python programming language then read this page carefully.

  Here...Write the key features of the Python programming 

  language, what are comment How can you add



         There are some excellent idea to help you make the new concepts, you are learning 

          1.Simple

          2.Robust

          3.Supports multiple programming paradigms

          4.Compiled as well as Interprete

          5.Cross Platform

          6.Dynamically Typed Language

          7.Object-Oriented Language

          8.Large Standard Library

          9.Dynamic Memory Allocation

         10.Support for Other Languages

1.Simple:

   Python is very simple 

   As compared to other popular languages like 

   Java and C++, it is easier to code in Python. 

   Python code is comparatively 3 to 5 times smaller than C/C++/Java code

simple Hello world print


IN C

#include <stdio.h>

int main(){

     printf("Hello world!");

     return 0;

}


IN JAVA

public class HelloWorld{

      public static void main( String[] args ) {

            System.out.println( "Hello world!" );    

      }

}


IN PYTHON

print('Hello world!')

swap 2 Numbers


IN C

int a=10,b=20,temp;

temp=a;

a=b;

b=temp;


...........

IN JAVA

int a=10,b=20,temp;

temp=a;

a=b;

b=temp;


...............

IN PYTHON

a,b=10,20

a,b=b,a

Add 2 Numbers

.......

IN C

#include <stdio.h>

int main(){

int a=10,b=20;

printf(“Sum is %d”,a+b);

return 0;

}


...........

IN JAVA

public class HelloWorld{

      public static void main( String[] args ) {

int a=10,b=20;

System.out.println( “Sum is “+(a+b));    

      }

}


................

IN PYTHON

a,b=10,20;

print(“Sum is”a+b)

......................

2.Robust:

Python has very strict rules which every program must 

compulsorily follow and if these rules are violated then 

             Python terminates the code by generating an “Exception” 


To understand python’s robustness , guess the output of the 

     following /C++ code:


int arr[5];

int i;

for(i=0;i<=9;i++)

{

arr[i]=i+1;

}

In Python, if we write the same code then it 

  will generate Exception terminating the code


  Due to this other running programs on the computer 

  do not get affected and the system remains safe and secure

3.Supports multiple programming paradigms:

   Python supports both procedure-oriented and object-oriented 

   programming which is one of the key python features.


  In procedure-oriented languages, the program is built 

  around procedures or functions which are 

  nothing but reusable pieces of programs. 


  In object-oriented languages, the program is 

  built around objects which combine data and functionality  

4.Compiled as well as Interpreted:

   Python uses both a compiler as well as 

   interpreter for converting our source and running it



  However, the compilation part is hidden from the programmer

  so most people say it is an interpreted language



5.Cross Platform:

   Let’s assume we’ve written a Python code 

   for our Windows machine. 


   Now, if we  want to run it on a Mac, we don’t

   need to make changes to it for the same. 


  In other words, we can take one code and run it on any 

  machine, there is no need to write different code for different machines. 


  This makes Python a cross-platform language



6.Dynamically Typed Language:

   Python is a dynamically-typed language. That means the type (for example- 

   int, double, long, etc.) for a variable is decided at run time not in advance because of this feature we don’t need to specify the type of variable.


   Attention geek! Strengthen your foundations with the 

   Python Programming Foundation Course and learn the basics.


  To begin with, your interview preparations Enhance your 

  Data Structures concepts with the Python DS Course.



7.Object-Oriented Language:

  Python supports object-oriented language and concepts of classes and objects come into existence. It supports inheritance, polymorphism, and encapsulation, etc. The object-oriented procedure helps to programmer to write reusable code and develop applications in less code.

8.Large Standard Library:

It provides a vast range of libraries for various fields such as machine learning, web developer, and also for scripting. There are various machine learning libraries, such as Tensor flow, Pandas, Numpy, Keras, and Pytorch, etc. 

Django, flask, pyramids are the popular framework for Python web development.

9.Dynamic Memory Allocation:

  In Python, we don't need to specify the data-type of the variable. 

  When we assign some value to the variable, it automatically allocates the memory to the variable at run time. Suppose we are assigned integer value 15 to x, then we don't need to write int x = 15. Just write x = 15.



10.Support for Other Languages:

     Being coded in C, Python by default supports the execution of code 

     written in other programming languages such as Java, C, and 

     C#, thus making it one of the versatile in the industry.


Comments in Python


   Comments are statements in our program which are ignored 

   by the compiler or interpreter i.e they are not executed by the language


We generally create comments to let developers understand our code’s logic.


This is a necessary practice, and good developers make heavy use of the comment system. 

Without it, things can get confusing

Types Of Comments In Python

.......................................................

Python provides 2 types of comments:


    1.Single Line Comment ( official way of the comment)

    2.MultiLine Comment ( unofficial way)

 1.Single Line Comment ( official way of the comment)

  Single-line comments are created simply by beginning a line with the hash 

  (#) character and they are automatically terminated by the end of line.


For example:

a=10

     #a=a+1

print(a)

Output:

10



Official Way Of Multi-Line Comments

.........................................................

To create Multi-Line Comments, the only problem with this 

style is we will have prefix each line with #, as shown below:

#a=a+1

#b=b+5

#c=c+10


But most Python projects follow this style and Python’s PEP 8 

the style guide also favors repeated single-line comments.

Un-Official Way Of Multi-Line Comments

If  we want to simplify our efforts for writing Multi-Line Comments

then we can wrap these comments inside triple quotes ( double or single ) as shown below

For example:

a=10

     ' ' ' a=a+1

           a=a+1  ' ' '

print(a)

Output:

10


Triple quotes don’t create “true” comments.



They are regular multiline strings, but since they are not getting 

assigned to any variable, they will get garbage collected as soon as the code runs.


 Hence they are not ignored by the interpreter in the 

the same way that # comment is.

Conclusion-In this tutorial you will have to learn the detailed Write the key features of the Python programming 

                language what are comment How can you add

                So hope you liked these tutorials.If you have any questions or 

                suggestions related to Python, please comment below and let us know.

                Finally, if you find this post informative, then share it with 

                your friends on Facebook, Twitter, Instagram. 


Thank you...

Comments

Popular posts from this blog

How to Send OTP in Mobile Number | login with OTP mobile Number | How to send OTP in mobile no with Spring Boot APP

   ðŸ˜‚               Login with Mobile Number OTP ---------------------------------------------------------------------------- If you want to develop a project to log in with OTP mobile Number in Spring Boot Applications then this post for you. In this post, I am going to use some other service to send the OTP in mobile number. we have to use it in this project spring boot. we are going to use Twilio to send SMS. we are going to use a web socket to send the data from the browser to the SMS gateway. Oracle Database for store the user details. <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> <version>2.3.3.RELEASE</version> </dependency> <dependency> <groupId>com.twilio.sdk</grou

Spring Boot With MySQL Database connection with Examples | MySQl Database Configuration with Spring Boot Projects

 ðŸ˜ƒ MySQL Database Configuration with Spring Boot Projects  In this article, we are going to introduce How to connect MySQL Database with the Spring Boot project. pom.xml   <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.projectlombok</gro

How can we create Auto generated field or ID for mongodb using spring boot

😂 How can we create an Auto-generated field or ID for MongoDB using spring boot? First Create One Application Like Mongodb_sequence-id-generator Pom.XML <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency> <dependency> <groupId>de.flapdoodle.embed</groupId> <artifactId>de.flapdoodle.embed.mongo</artifactId> </dependency> User.java package com.app; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.mongodb.core.mapping.Document; @Document(collection = "users_db") public class User { @Transient public static final String SEQUENCE_NAME = &