Get Introduced To Python in 10minutes!

1_to0Tp8CBi-vbKvu-ljPukg

Get Introduced To Python in 10minutes!

Sharanya Bhat

Sharanya Bhat

Share on twitter
Share on linkedin
Share on facebook

Get Introduced To Python in 10minutes!

Python is the most trending and widely used object oriented programming language in the present world of development, created by Guido van Rossum in the 1980s. Python is designed to be a general purpose, high-level, interpreted programming language and is open source. One can download it easily from Python.org. This was a basic introduction to python and as we go deep into the article we will take a shallow dive into it. Get ready for an amazing python tour!

Why python?

There are many other object and procedure oriented programming languages like C, C++,Java,C# and so on, but what makes python special is, it’s easy to use less complicated syntax which even amateur developers can learn very easily. When I first started learning python, I was amazed with the way how it’s syntax is designed. It gives more emphasis on natural English language and due to its ease of understanding and usage, it’s highly popular and even can be executed much faster when compared to any other programming language.  

 

The most cute thing I noticed about python is the “traceback” it gives for compilation errors, it seemed to me as if python is not understanding my statements and is angry. Unlike other programming languages that tell it on a developer’s face as “syntax error”, python gives a traceback requesting its programmers to trace their mistakes and tell the statements more clearly. In my opinion traceback is the polite way of calling a syntax error or any other compilation error that a programming language throws at programmers. There is a beautiful trick to overcome the exasperation that one goes through while facing traceback especially after coding for hours, this usually happens with every programmer and has an easy way to handle it. Keep reading to know!

 

An amazing feature of python is that its programs can be easily converted to softwares, with the help of different libraries such as pyinstaller or py2exe and such. The main advantage behind this is, any python software consisting of an executable file can be magically executed even on computers with no python installed and reason for this is, python being an interpreted language, while conversion of python program to python executable software, the interpreter is incorporated into the same folder as where python executable file is placed, hence enabling it to be executed on devices with no python installed. Python programs are saved with extension .py and a simple command in CLI can convert this program to software, this helps developers convert their great codes to softwares in minutes. The different web scraping programs that I developed got converted into softwares within no time and were all up and running in a few blinks.

 

Python with its vast collection of libraries, supports web-backend development, game development and software development which all together have taken a common name as python development. I have seen my friends enjoying the oldest snake game that can be developed using python easily. Apart from this even different types of adventurous games can be developed using python. 

 

Python even contributes to immensely popular technological fields like data science, artificial intelligence, machine learning, big data, cloud computing, open CV,deep learning and such with its libraries and frameworks such as numpy, tensorflow, django,flask beautiful soup,scipy and so on and all these libraries help a lot in initial cycle of development, saving a lot of time of the developers and with all these functionalities python has proved itself as the most powerful programming language in the world of development with many companies using it as their official programming language, Google is one such example.

 

I started learning python through an online specialization, my instructor Dr. Charles Russel Severance, always used to say a trick to handle the anguish mixed irritation a developer would get by seeing tracebacks, for that matter say, a compilation error pops up giving a traceback and we go mad at it, he used to say, to consider python an innocent baby snake that is angry at us as it didn’t understand what we just told it. This thought alone would bring a smile on my face whilst coding, instead of exasperation. Apart from this cute side, python even has a powerful side, with a potential to do various tasks as per developers interests, Let’s move on to that now.

Python versions

Python has a good range of versions and first appeared 30 years ago, with its first version released in 1991. Python3 is considered to be the stable release of python with 3.8.0 being the latest release. For python releases 2.7.9 and 3.4 onwards pip, a python standard package manager is made available with python installation and is used for installing additional libraries that are not inbuilt standard libraries of python and can be installed using a simple CLI command as pip install library_name. For earlier versions of python, pip needs to be installed separately. My suggestion for any python beginner would be to dive into python 3.

Basics of Python

Python 3 and its updates, being the most stable releases of python are widely used by developers. Like any other programming language, python3 as well as other python versions provide loops, branching statements, functions, classes and use of variables for developers to code at an ease. We will be focusing on python 3 and its basic functionalities, most of which is similar to python 2. The print statement of python 2 has become a print function in python 3 and is written as print(“whatever to be printed”) for example:print(‘Hello world!’) and that ends our python 3 hello world, as simple as that. The raw_input() function of python2 has become only the input() function in python 3. In python 2, the implicit str type is ASCII and in python 3 its Unicode. Python even supports error handling with try/except code blocks where there are certain small but noticeable changes in these two versions of python. Apart from this they even differ in xrange() function and _future_ module

 

Python unlike some other programming languages doesn’t differentiate between characters and strings through their writing styles, for example “hello” and ‘hello’ both are considered as strings and ‘h’ is considered as a character because it’s a string with length 1. Hence python is smart enough to understand the difference between strings and characters and like many other popular programming languages strings in python are arrays and characters are strings with length 1. Even, there is no need to mention data types of variables in python as the interpreter understands it based on the value given to a particular variable. Now this in my opinion is highly convenient for any programmer and as for me, when I would code in c++, I would always forget to declare variables with its data types and end up getting compilation errors, but the python interpreter manages all of it magically.

 

Python variables even accept all types of integer and decimal values and even provides many standard library functions to operate on them such as ord(), str(), int(), Round(),float() and many more where these inbuilt functions operate on different types of variables.

 

Python even allows conditional branching with if, elif and else statements, where every line inside loops, functions and conditional statements of python must be indented and kept at the same indent level for the interpreter to understand which statement belongs to which block. If you miss an indent the baby snake is going to get very angry, so do remember!

 

In order to tell the interpreter that a block of code has come to an end, the next statement is unindented to the previous indent level of other blocks of code. For-loop in python is amazingly designed and is completely different from for-loop in many other programming languages. A single mentioning of the iteration variable would be enough to complete the loop and iterate till the end. For-loops easily make out the end of data structures like tuples,lists and dictionaries and there is no need of mentioning a separate ending condition.

 

Just like all other programming languages, python has its own data structures where lists are nothing but arrays and tuples are arrays with rounded braces. Dictionaries are little different where all the values are stored with keys referencing it, hence it follows keys as its index. Python even facilitates use of regular expressions that reduce both length of code and time taken by the programmer to code.

 

While loops are having true condition as default condition for entering  the loop and terminating condition must be mentioned separately inside the body of the loop. In order to define a function in python, define keyword is used and when control encounters a function call it automatically shifts to body of the function and executes the statements there, though this sounds similar to execution flow of functions in other programming languages, there is a lot of difference in their syntaxes where unlike other programming languages functions in python doesn’t  need to be mentioned with their data types but parameters if any, must be compulsorily mentioned, again without their respective data types. Python follows ‘#’ for single line commenting and multiline comment blocks are not supported hence consecutive single line commenting is followed to comment out multiple lines.

 

Python for a reason is termed as an object oriented programming language where it supports all the features of OOP, such as defining classes, polymorphism, encapsulation, inheritance and gives a greater emphasis on objects with class serving as a blueprint of the object and object as the instance of the class. For instance, objects can be people, cities, countries etc and usually are common nouns containing data like name, place,address,age etc. Definition of classes contain methods or functions and can be accessed through objects. 

Wonderful Python

Python is the second most widely used programming language for data science after R. Python mainly finds its use in data science fields like machine learning, deep learning neural networks, big data, cloud computing and what not. It has made its place in almost all the popular fields and it’s knowledge is compulsory to enter the field of data science. I had learnt this amazing fact from one of the courses that google offered is that, Artificial intelligence is a sub field under computer science and  Machine learning is the sub field of artificial intelligence, and is incorporating deep learning. Data Science for that matter has all of their applications in parts, making them its sub domains. Henceforth, python is spread across all of these fields, confiscating the entire computer science domain in its beauty and power. 

 

Python has even spread its wings across the field of full stack development by providing various web frameworks such as django, flask, web2py and so on. Flask and django are my all time favourites due to their routing and syntax simplicity and their compatibility with javascript. I was amazed when I found out that it’s possible to write python logic along with html! on the python framework development. Yes you read it right! It’s possible due to template engines like jinja and django template engine. 

 

Along with this python supports even database management with a python-mysql package that has a MySQLdb, OurSQL and so on modules that is actually written in C language. I kept on clapping for the python creator in my mind when I worked with this amazing package where python and mysql are combined to manage databases. Python even has a library sqlite, with the help of which a database file is generated by itself and the developer needs to just provide the name he wants to give to the database. This is compatible only with sqlite browser.

Conclusion

Python with all it’s amazing features and being the most efficient programming language is trending in the field of development and is expected to be the most widely used development language in the world of technology than now. This ends your python tour for now, but definitely is not the ending of python! as it gets even more amazing as one goes into its intricacies.

[mc4wp_form id="11379"]

About the Author

Read More

Codemithra Team

Role of AWS in our Daily Lives

In the last decade, cloud computing has become tremendously popular for its agility, flexibility, and ease of use. One of the world’s broadly used loud platforms is Amazon Web Services (AWS). Adopted by most startups, government organizations, and multinational corporations, today, AWS has the highest market share in the cloud computing industry.

Read Now
Codemithra Team

Top Companies Looking for AWS Certified Users & Salaries They Offer

The AWS certification is a level of Amazon Web Services that validated technical cloud knowledge. The certificate is proof of the IT professional’s ability to manage and design cloud initiatives. There are four levels of AWS certification- foundational, associate, professional, and specialty.

Read Now

Codemithra is here to help you!

Terms & Conditions

This Privacy and Security Policy is provided for the benefit of customers and clients of Ethnus Consultancy Services Private Limited. (“Ethnus”) as well as other consumers and parties who use Ethnus and/or its website(s), particularly codemithra.com (“Website”, “www.codemithra.com”, “Codemithra” or “Ethnus Codemithra”), and/or applications (“Apps”) (collectively, “Ethnus Services” or “Ethnus Platform”).

Since Ethnus serves several different audiences, customers find it helpful to read the Terms of Use that apply specifically to them based upon the purpose for which they use Ethnus. For this reason, we link to three separate agreements below for employer customers, job seeker customers, and staffing customers, respectively.

For your convenience, we define each of these audiences that Ethnus serves as follows:

“Employer Customer” means an entity using Ethnus Services that is seeking to hire an individual as an employee and/or independent contractor to be employed by it directly.

“Job Seeker Customer” means an individual using Ethnus Services who is seeking to be employed as an employee or independent contractor by an employer.

“Staffing Customer” means a staffing company using Ethnus Services that provides staffing services to their own Staffing Clients.

So long as your use of the Ethnus website and services remains within the scope of the particular audience or customer for which you began using Ethnus (e.g. a job seeker does not use Ethnus as an employer, or an employer does not use Ethnus as a job seeker), the complete Terms of Use applicable to your use of the Ethnus website and services is contained within the applicable Terms of Use linked below.

Employer Terms of Use

The following Terms of Use apply to any Ethnus Employer Customer seeking to hire employees or independent contractors for its own business. If you seek to find employees or independent contractors for the benefit of your clients (and not yourself), you need to review the Terms of Use specifically for our Ethnus Staffing Customers accessible at www.Codemithra.com/terms/staffing.

Ethnus, Inc. (“Ethnus”) provides online services through which employers and staffing companies seeking employees and independent contractors can efficiently and effectively review and interview candidates. Ethnus provides these services and its suite of features and products through its Apps and Website (collectively, “Ethnus Services”) subject to these terms of use (“Terms of Use”) and the agreements incorporated herein.

Your privacy is very important to us. We designed our accompanying Privacy and Security Policy to provide important disclosures about how your information will be used by Ethnus in providing you Ethnus Services. These Terms of Use expressly incorporate our Privacy and Security Policy.

Please read these Terms of Use and our Privacy and Security Policy carefully before using any of the diverse Ethnus Services. By visiting the Website, installing any of the Apps, and/or using any of the Ethnus Services, you shall have affirmed your agreement to these Terms of Use.

1. Definitions

2. Modifications – Will Ethnus ever modify these Terms of Use?

3. Ethnus Services – What are the Ethnus Services?

4. Video Content and Services – How and when do you record videos?

5. Pricing, Payments, and Billing – How and when will I be billed for Ethnus Services?

6. Objectionable Content – What if I find content to be objectionable?

7. Customer Conduct

8. Intellectual Property

9. DMCA Policy

10. Reserved for Future Use

11. Resale of Services

12. Indemnification

13. Disclaimer of Warranties

14. Third Party Links and Products

15. Limitations of Liability

16. Exclusions and Limitations

17. General Terms

1. Definitions

“Consumer” means any individual or entity that uses any of the Ethnus Services. Where applicable, the term “Consumer” shall encompass all Ethnus Customers.

“Content” means all material, whether publicly posted or privately transmitted, available on or through any of the Ethnus Services.

“Customer” means, for purposes of this Terms of Use, You, a Job Seeker Customer.

“Customer Content” means any Content uploaded to and/or created through the Ethnus Services by a Ethnus Customer.

“Employer Customer” means an entity using Ethnus Services that is seeking to hire an individual as an employee and/or independent contractor to be employed by it directly.

“GDPR” means the European Union’s General Data Protection Regulation.

“Job Seeker Customer” means an individual using Ethnus Services who is seeking to be employed as an employee or independent contractor by an employer.

“Profile Video” means a promotional video created by a Job Seeker Customer to promote themselves as a candidate employee and/or independent contractor. It is not an interview. The Job Seeker Customer completes this independently and on their own.

“Software” means any necessary software used in connection with the Ethnus Services.

“Ethnus Account” means an account associated with a Ethnus Customer who uses or has used Ethnus Services.

“Ethnus Content” means any Content excluding Customer Content and Video Content in which Ethnus does not participate.

“Ethnus Customer” means any person who uses or has used Ethnus Services including, but not limited to, Employer Customers, Job Seeker Customers, and Staffing Customers.

“Ethnus Services” means the suite of features, products and services offered through Ethnus, its Apps, its App Services, the Website, and the Website Services.

“Ethnus Trademarks” means any trademarks, tradenames, logos, and other commercial designs of Ethnus or licensed to Ethnus, whether or not formal registration exists including, but not limited to, “Ethnus.”

“Staffing Clients” means third-party employer clients of Staffing Customers.

“Staffing Customer” means a staffing company using Ethnus Services that provides staffing services to their own Staffing Clients.

“Strategic Partners” means those trusted partners that Ethnus employs, engages, or retains to perform functions and/or provide services on its behalf.

“Sub Accounts” means subsidiary accounts created for or by an Employer Customer or Staffing Customer (“such as a consultant group or employer”) under its primary account.

“Username” means the valid email address provided by each Ethnus Customer to be used as their username or login identification.

“Video Content” means any video content created by or associated with any Ethnus Customer accessible on and through Ethnus Services including, but not limited to, Profile Videos, Video Questions, Video Interviews, and Welcome Videos.

“Video Interview” means an interview completed through Ethnus Services using a video or “web” camera that an Employer Customer or Staffing Customer requests a Job Seeker Customer complete. A Video Interview may involve a Job Seeker Customer alone or with other participants from an Employer Customer or Staffing Customer. A Video Interview may be pre-recorded by a Job Seeker in response to questions or occur live at which time it would be recorded.

“Video Question” means a question recorded in video and audio that can be sent to potential employee and independent contractor candidates by an Employer Customer or Staffing Customer.

“Website” means all of the content, information and services (in any format whatsoever) accessible through the World Wide Web at the domain name Codemithra.com.

“Website Services” means the services provided by Ethnus through the website at the domain name Codemithra.com, hire.li, and any of our other websites that may be used from time to time

Ethnus User Agreement

I agree to submit my personally identifiable information to Ethnus, who may use it to communicate regarding their events, courses, and other services through various media including phone calls, text messages, email, and social media. I also agree with Ethnus’ Privacy Policy and Terms of Service.

I agree with Ethnus sharing my personal data, including email address, with Salesforce family of companies, who may contact me for sales and marketing purposes and as described in Salesforce’s Privacy Statement.

Privacy Policy

This Privacy Notice describes how we collect and use your personal information in relation to Ethnus websites, applications, products, services, events, and experiences that reference this Privacy Notice (together, “Ethnus Offerings”).

This Privacy Notice does not apply to the “content” processed, stored, or hosted by our customers using Ethnus Offerings in connection with an Ethnus account. This Privacy Notice also does not apply to any products, services, websites, or content that are offered by third parties or have their own privacy notice.

Personal Information We Collect

We collect your personal information in the course of providing Ethnus Offerings to you.

Here are the types of information we gather:

        a) Information You Give Us: We collect any information you provide in relation to Ethnus Offerings. Click here to see examples of information you give us. Example: Name, email, phone, etc.

        b) Automatic Information: We automatically collect certain types of information when you interact with Ethnus Offerings. Example: IP address, location, browser identity, etc.

        c) Information from Other Sources: We might collect information about you from other sources, including service providers, partners, and publicly available sources. Example: marketing analytics, keywords, etc.

How We Use Personal Information

We use your personal information to operate, provide, and improve Ethnus Offerings. Our purposes for using personal information include:

        a) Provide Ethnus Offerings: We may use your personal information to provide and deliver Ethnus Offerings and process transactions related to Ethnus Offerings, including registrations, subscriptions, purchases, and payments.

        b) Measure, Support, and Improve Ethnus Offerings: We use your personal information to measure use of, analyze the performance of, fix errors in, provide support for, improve, and develop Ethnus Offerings.

        c) Recommendations and Personalization: We use your personal information to recommend Ethnus Offerings that might be of interest to you, identify your preferences, and personalize your experience with Ethnus Offerings.

        d) Comply with Legal Obligations: In certain cases, we have a legal obligation to collect, use, or retain your personal information.

        e) Communicate with You: We use your personal information to communicate with you in relation to Ethnus Offerings via different channels (e.g., by phone, email, chat) and to respond to your requests.

        f) Marketing: We use your personal information to market and promote Ethnus Offerings. We might display interest-based ads for Ethnus Offerings.

        g) Purposes for Which We Seek Your Consent: We may also ask for your consent to use your personal information for a specific purpose that we communicate to you.

Cookies

To enable our systems to recognize your browser or device and to provide Ethnus Offerings, we use cookies.

How We Share Personal Information

Information about our customers is an important part of our business and we are not in the business of selling our customers’ personal information to others. We share personal information only as described below and with Ethnus Consultancy Services Private Limited, . and its affiliates that are either subject to this Privacy Notice or follow practices at least as protective as those described in this Privacy Notice.

Transactions Involving Third Parties: We make available to you services, software, training, and content provided by third parties for use on or through Ethnus Offerings. You can tell when a third party is involved in your transactions, and we share information related to those transactions with that third party. For example, you can order services, software, and content from sellers using the Authorized Training Partner’s marketplace and we provide those sellers information to facilitate your subscription, purchases, or support.

Other than as set out above, you will receive notice when personal information about you might be shared with third parties, and you will have an opportunity to choose not to share the information.

How We Secure Information

        a) We protect the security of your information during transmission to or from websites, applications, products, or services by using encryption protocols and software.

        b) We maintain physical, electronic, and procedural safeguards in connection with the collection, storage, and disclosure of personal information.

Internet Advertising and Third Parties

Ethnus Offerings may include third-party advertising and links to other websites and applications. Third party advertising partners may collect information about you when you interact with their content, advertising, or services. For more information about third-party advertising, including interest-based ads, please read our Interest-Based Ads notice.

Access and Choice

You have choices about the collection and use of your personal information. Many Ethnus Offerings include settings that provide you with options as to how your information is being used. You can choose not to provide certain information, but then you might not be able to take advantage of certain Ethnus Offerings.

        a) Communications: If you do not want to receive promotional messages from us, please unsubscribe or adjust your communication preferences in the emails.

        b) Advertising: If you don’t want to see interest-based ads, please adjust your Advertising Preferences.

        c) Browser and Devices: The Help feature on most browsers and devices will tell you how to prevent your browser or device from accepting new cookies, how to have the browser notify you when you receive a new cookie, or how to disable cookies altogether.

Children’s Personal Information

We don’t provide Ethnus Offerings for purchase by children. If you’re under 18, you may use Ethnus Offerings only with the involvement of a parent or guardian.

Retention of Personal Information

We keep your personal information to enable your continued use of Ethnus Offerings, for as long as it is required in order to fulfill the relevant purposes described in this Privacy Notice, as may be required by law (including for tax and accounting purposes), or as otherwise communicated to you. How long we retain specific personal information varies depending on the purpose for its use, and we may delete your personal information in accordance with applicable law.

Contacts, Notices, and Revisions

If you have any concern about privacy at Ethnus, you may also contact us at the addresses below:

Ethnus Consultancy Services Pvt Ltd,

SST Chambers, No.151/17/1 Second Floor, 36th Cross Rd, 5th Block, Jayanagar, Bengaluru, Karnataka 560041

Or, email us at reachus@ethnus.com

Or call us at: +91 – 8929 334 324

You will find the updated contact information on our website: www.ethnus.com/contact/

If you interact with Ethnus Offerings on behalf of or through your organization, then your personal information may also be subject to your organization’s privacy practices, and you should direct privacy inquiries to your organization.

Our business changes constantly, and our Privacy Notice may also change. You should check our website frequently to see recent changes. You can see the date on which the latest version of this Privacy Notice was posted. Unless stated otherwise, our current Privacy Notice applies to all personal information we have about you and your account. We stand behind the promises we make, however, and will never materially change our policies and practices to make them less protective of personal information collected in the past without informing affected customers and giving them a choice.