Cool Things to Do in Python

Cool Things to Do in Python

Trying to figure out some cool things that you can do in Python that can turn into a great learning experience? Not just Python, any programming language that you are learning is easier to understand if you create some practical solutions, even some impractical solutions, while learning it. In this article, we are going to learn to do some cool things in Python so that the process of learning this great programming language turns into a fun experience. Ready to roll? Building cool things with Python will take time and if you want to save time from doing your Python assignments? Contact us to get help with your Python assignments.

First, let us learn some basics about the Python programming language.

Best Programming Services on the Internet.

What is Python and why is it used?

Although we know that you’re craving to learn to do some cool things in Python, learning more Python will help you relate to it and understand its true power and significance not just in the history of programming, but also in terms of knowing its potential.

Developed and released by Guido van Rossum in 1991, Python is used for many purposes. It is mostly used for

• Web development and programming (server side)
• Software development
• Solving mathematical problems
• Writing in executing system programs

Cool Things to Do in Python
Cool Things to Do in Python

Although you can do many cool things in Python, it is an interpreter-based, high-level, general-purpose programming language. It works well both for small and large scale projects. You can do object oriented programming in Python just as in C++. Programmers prefer to use it for its very clear code readability. In fact, not just object oriented, it supports many programming paradigms including structured programming, object-oriented programming (mentioned above) and functional programming. It is often described as a “batteries included” language because of the comprehensive list of standard libraries that come with it.

Why do many programmers use Python?

Python is a very versatile language. Since it is a server-side language, advanced web applications can be written in Python. Although enterprise level software applications may be a bit difficult to create in Python, the language can be used alongside software to create workflows. It easily connects to database systems. It can read and modify files. Its ability to process big data makes it a favorite among mathematicians to perform complex mathematical calculations. It is often used for rapid prototyping and sometimes even for production-ready software development.

More reasons why Python is used:

• It works on different platforms including Raspberry Pi, Linux, Mac systems and Windows.
• Its syntax is very simple, almost like the English language.
• It allows programmers to achieve tasks with fewer lines compared to other programming languages.
• Since Python is an interpreter-based language, it can be immediately run using the interpreter without the need of being compiled first. This way, prototyping is easier and quicker.
• You can program using different modes including procedural, object-oriented and functional.

Aside from doing cool things, how does Python make it easier for students to learn programming?

If you have never worked with a programming language before, the first glimpse of the Python programming language may be intimidating but then this is the case with every language. Hence, no matter with which language you decide to start your programming journey, you will need to make yourself comfortable with the syntax of the programming language.

With this out of the way, why Python is a better programming language if you want to learn programming as a student?

Python comes with almost every system. Whether you have Windows or Mac or Linux, Python should already be installed on your system. Want to check whether Python is installed on your PC?

Here is what you need to do…

On Windows 10, press Win+R

Then enter “powershell” and press Enter/OK

If a window appears and you see a prompt, then Python is installed.

If you want to see which version of Python is installed on your PC, just type the following command at the prompt:

python –version

Hence, once you know that Python is live and kicking on your computer or laptop, you can start doing cool things with Python.

How does making cool things in Python help you learn programming?

Fruitful programming is all about applicability. You have a problem. You want to solve it. When you solve the problem, even if in the beginning you don’t know how to solve it, by the time you have solved it, you have understood many concepts. The same happens with programming.

It is less inspiring to learn for loops or if-then-else decision trees unless you actually use them and see them working how they impact the flow of your Python program. Making cool things in Python is often sometimes called the “project-based learning approach”.

When you make cool things in Python, you feel motivated. Because you know there is a problem that needs a solution and you can find it. Maybe you can build a useful application that will benefit you or other people. Maybe this can turn out to be a new million dollar idea. Solving problems is a great motivation to learn something new.

When you make cool things in Python, you develop your problem-solving skills. By the end of the day, programming is all about problem-solving. You are constantly figuring out things to achieve. Undoubtedly, programmers are one of the smartest people in the world.

You also learn to work efficiently. When you are making programs just for fun and just for the sake of learning, you can improve your level of efficiency by getting rid of redundant code and optimizing your programming methodology.

Eventually, when you make cool things in Python, you can include them in your portfolio, especially when some people can actually use them to solve real-world problems.

Some great Python resources before making cool things

Preferably, when you are just learning, you should write every bit of code on your own. For example, instead of fetching a script from somewhere that displays “Hello world.” in Python, it is better to write it yourself.

When it comes to building small programs, again, it is better that you write everything on your own because you are learning.

But when you are solving real problems, when you are making some cool things that can be used by you and people, you can also resort to getting some prewritten scripts in Python that are available all over the Internet by the thousands.

Github is often the first choice. It has millions of scripts in practically every language on earth and naturally, it also has practically an unlimited repository of Python scripts. You can go to this section on Github to download whatever code samples or code libraries that you need to make cool things in Python.

Here is another Python code repository called Awesome Python that has hundreds of Python programs you can download and study.

One of the most widely used Python frameworks is Flask. It gives you everything you need to develop web-based applications in Python. It doesn’t need additional libraries. You can download it and start working in Flask immediately.

If you’re wondering what is a framework, it is usually a set of code libraries that gives you everything you need to build your own programs.

Why do you need a framework?

It’s something like this. Using a Python command, you want to display something on your computer screen. Now, displaying something on your computer screen may seem quite a simple task to you because you’re looking at things on your computer all day, programmatically, it involves lots of programming.

Even if you want to display something like “Hello world”, lots of programming is needed, but in Python you simply have to type

print(“Hello World.”)

So, there is a library of code snippets that makes it easier for Python to simply use the print command to display this text.

Similarly, there may be just a single command for displaying all the files in a folder on your computer, but in reality, multiple code libraries may be needed to interact with the Windows core program and then display the information according to the Python program.

Another, one of the most widely used Python frameworks is Django. Django is an open source Python web framework primarily used for rapid development. It is a toolkit of all components that you need to build a robust web application in Python. This framework helps you focus on the main task of creating your application rather than worrying about related but important code libraries. It gives you the templates, the libraries and the APIs to build full-fledged Python applications.

Lastly, we come to the IDE, which stands for “Integrated Development Environment”. It is usually a software application (including a code editor) that provides everything you need to build a solid application in the programming language of your choice. Yes, Python also has its own IDE.

Even the usual text editors, for example, Sublime Text or Notepad++, are often termed as IDE options.

The purpose of an IDE is to give you an environment that makes it easier to write programming code.

By default, when you install Python on your computer, it comes with its own default IDE called IDLE. It enables you to immediately start making cool things in Python. It gives you syntax highlighting, auto-completion, smart indentation and a debugger.

Yes, this is one of the biggest differences between the usual text editors like Sublime Text and IDE solutions.

Universal text editors give you features like auto completion, syntax highlighting, smart indentation and auto suggestion, they often don’t come with an integrated debugger.

Such an integrated debugger comes with a dedicated IDE. This is why, if you work in Python, you work in an IDE that is specifically designed for Python and if you work in C++, you work in an IDE that is specifically designed to work in C++.

For smaller programs, it is fine to work with text editors but when you want to do real programming and you want to make sure that your programs don’t contain bugs, it is always better to work with and IDE. An IDE is often not glamorous, but it does the job you want it to do.

Now let’s come to the interesting part, making cool things in Python.

Design a contact form for your website
It is always nice to allow people to submit a contact form on your website if you want them to get in touch with you. Though you can simply display your email ID but then it needlessly exposes your email ID to email farming bots and also, it forces people to go back to their email program and as a result, leave your website.

A contact form on the other hand keeps people from going away from your website. They can quickly fill up the required fields such as the name, the email ID, the phone number, and a small message and submit the form.

Usually, the form part, the fields and the submit button that you see in front of you, is built in HTML.

Once the submit button is clicked, another program or script captures all the information and then emails this information to you in an understandable format.

12 Important Python Programming Tips.

This may involve multiple processes including

Capture the values of the name, the email ID, the phone number and the message.
Do some validation to make sure that all the necessary fields have been filled and are in the right format.
Establish a connection with the email server.
Send the email to you with all the details.
Show a thank you page to the visitor.

These tasks cannot be achieved simply with HTML. Programming is required. You can do this programming in Python.

Build a GUI calculator in Python

So far you may have seen that only elementary, text based programs are built in Python, or some processes that work in the background, for example processing a contact form on a website. What about building a GUI application, for example, a calculator? Can this be achieved with Python?

Surely it can be done. For that, you need to use Tkinter, the standard GUI library for Python.

GUI programming is a bit different from usual programming like C because in GUI programming, you create lines of code for individual components. For example, there will be a section where you will be writing code for the “+” button (while building a GUI calculator in Python), a section for “-“, and such.

In fact, although your operating system may already have a calculator application, building a GUI calculator in Python is another cool thing you can do.

Create a file server using the Python prompt

First of all, what is a file server? Traditionally, a file server is a remotely accessible computer where files that are to be shared by multiple people on multiple devices, are kept.

How can this be important in your case? Suppose you have some interesting music files on your computer. Or you have movies. You want to transfer these files to another computer, laptop, or even your mobile phone, but you don’t want to use a data cable or you don’t have a data cable.

One option is to install multiple programs on your computer and then on other devices. One set of programs creates a server on your PC that makes it available to all the other devices on the network. Another set of programs creates an interface on other devices so that they can access the server and consequently, the files on your PC. Why go through all the trouble if this can be achieved just by a single line of code on the Python prompt?

Just type

python -m SimpleHTTPServer #default port 8080

That’s it. A file server is running on your PC. Now you can access all your files from different devices as long as they are connected to the same network.

On the other device, simply open the browser and in the URL locator bar, type “localhost:8080” and you can access all the files on the file server you have just created.

Isn’t this a cool thing to do in Python?

Write a password generator in Python

Generating a password can be a big challenge for many. Although we all know that it is very important to generate a complicated password, call it laziness or something else, when it comes to generating a password, we take the easier course and try to create a combination of our name, or the name of someone we know, combined with the date of birth, or another memorable number. This makes it easier for hackers to hack into your account.

Ideally, a password must have at least eight characters. We should also have uppercase and lowercase alphabets. Every password must also have at least one numeric character. If you also add special characters even an eight-character password can take billions of years for a computer to crack your password.

What about creating a password like tP*gj2O5VnXcZ@LD?

Using Python, you can create a password generator. Once you have written your program, you can simply change certain parameters, for example, the length of the password, or the characters that you want included in the password, and then run the program either on the command prompt or using the IDE. Or best, use the GUI for Python to create a quick Windows-based program for generating highly complex passwords.

Find it difficult to remember such passwords? Naturally. You can create an Excel sheet with a master password and then save all the passwords in the sheet. In one column you mention the service name (for example Gmail) and in the second column, you can mention the password. Then you can protect this Excel sheet with a master password that you can memorise.

For that matter, there are many plug-ins available these days that allow you to manage thousands of passwords with a single master password, but that’s a different topic.

Create a web crawler using Python

A web crawler can be used for your own website as well as for other websites if you want to keep track of information being published on the web.

First, what is a web crawler?

How does Google know you have published a new web page or blog post or a Twitter update? The search engine is constantly crawling the web for new and updated information. Then it adds this information to its database for ranking and searching purposes.

How can a web crawler benefit you?

Suppose you have 200-300 webpages on your website. You want to find out all the web pages where you have by mistake mentioned your personal email ID. You can use a crawler that crawls all your 200-300 webpages and then presents you with a list of those web pages that contain your personal email ID.

It also has other benefits. Suppose you want to monitor conversations on social media websites like Facebook, LinkedIn and Twitter. What if you want to be notified whenever someone mentions your business name or your brand name? You want your crawler to email you the link of the web page or the social media post where people have talked about your business because you want to observe and possibly, want to react whether people talk about your business positively or negatively. You can achieve this using a web crawler.

In Python you can create a web crawler using Scrapy for Python. It is a powerful framework for extracting, processing and storing web data.

If you don’t want to use a framework, especially when you want to make something cool in Python, and as a result, want to create a web crawler from scratch, you can do that. You can write a Python web crawler completely from scratch using the Python Standard Library and other request modules. Some amount of research will be required, but this will be more rewarding compared to using a framework that practically gives you everything.

Take automatic backups with Python

Although computers are much sturdier these days than they were a few years ago and with various cloud storage services only some really freaky incidents can destroy your files, taking regular backups is always advisable.

Taking daily backups can also be tedious, especially if you have a process to follow. For example, there may be some 20 odd files that you need to backup everyday at 7:30 PM. Maybe you want to zip these files and then store the zip file somewhere safe.

With Python you can automate this task. There are many Python scripts available online that you can download and set them to run on your Windows PC at a set interval. You will need to make some changes so that the script knows which files to backup, which folders to access while backing up, what should be the name of the zip file and to which folder the zip file must be saved.

Do you need to keep your server running all the time so that at set intervals the Python script is executed?

Not necessarily. If you are using a Windows PC (another operating system must have its own equivalent), you have a feature called The Windows Task Scheduler. The task scheduler can be used to run a batch file (it cannot directly run a Python script). The patch file just needs to contain the line that refers to the Python file. Once you have instructed your Task Scheduler to run the batch file (that in turn runs the Python script), your files will be regularly backed up.

Automating social media updates with Python

Another cool thing you can do with Python is posting on social media websites such as Facebook, Twitter and Instagram.

Social media marketing is an integral part of digital marketing these days. If you don’t have a social media presence, it is almost impossible to build your brand because most of your customers and clients prefer to interact with brands that have an active social media presence.

One of the very important activities that help you create a vibrant social media presence is posting regular update – publishing quality content on social media websites.

But you don’t have to sit in front of your computer or carry your mobile phone with you all the time if you want to make timely updates. Suppose you want to post updates with the time interval gap of two hours. If you are a busy person it is difficult for you to remember to post your updates every two hours.

There are many services available on the Internet, like Hootsuite and Zoho Social, that allow you to schedule your updates, but they cost money.

Writing a Python script on the other hand not only gives you something cool to make with Python, but also gives you a free alternative.

A Python script can access your prewritten updates, fetch them from a file, and then post them on your preferred social media website.

How you decide to build the script depends on you. There are multiple ways of achieving the task. One of the methods is, preparing a Google Sheets document with different columns (for example, whether a particular update has already been posted or not). Google is very friendly with Python. In fact, Google has its own Python Quickstart Guide. In this guide Google tells you how to access your documents through your Python script.

For updates content you can use Google Docs documents and for posting on social media websites you can use their dedicated APIs. Once you have established a connection, you can easily, automatically post updates on different social media websites at set intervals.

Improve your vocabulary with Python

Want to improve your vocabulary? Whether you are learning English, Japanese or any other language, building a list of solid vocabulary is a must. Vocabulary allows you to use the right word for the right expression or the right feeling.

In Python, you can write a script that goes through an array of words and their meanings and then gives you a random selection to help you remember them. This is a manual process. You will need to create an array which randomly displays you the words and their meanings.

You can also use an online dictionary API to choose words and their meanings. Online services like Google dictionary and make their API available to students and people who are learning to program so that they can build their own dictionary applications or vocabulary building apps.

Build a countdown clock and timer with Python

Having your own countdown clock and timer is a great way of optimizing your time. Independent professionals often use even paid timer and countdown clocks to keep track of their time and then charge their clients for the time they have spent working. The script can be used to show the countdown clock in terms of days, hours, minutes and seconds. You can also set the timer in the same manner.

Develop a currency converter in Python

This is another cool thing you can develop using Python. Some people need to use the currency converter on regular basis to find the value of their currency in terms of another currency. For example, if someone gives you $ 60 and you are in India, you immediately want to know how many rupees this amount is going to be.

Of course, you can quickly type in Google and find the answer but it is always fun to write your own code for currency conversion.

The success of your currency conversion depends on the accuracy of your data. There is a “fixer API” used by many programmers to get the latest currency rates vis-à-vis dollar and other major currencies of the world. Once you have stored this information in an array, all it takes is supplying both the currencies and getting their conversion rates.

You can use the GUI Python builder to create a small desktop application or even a mobile app to have your own currency converter.

Use Python for scientific and advanced mathematical calculations

Do you know that Python has a separate math module? Researchers, scientists and mathematicians often use Python for complex computing.

A long time ago people used to have physical calculators. Although these calculators had regular buttons for regular mathematical and scientific computations, the nature of some computations was beyond the scope of the buttons of the calculator. These computations needed to be programmed. The mostly used BASIC programming.

For example, computing sides of a Pythagoras Triangle with the help of sinθ and cosθ. If you are an engineering student, there must be many calculations that are beyond the scope of the usual calculators. What do you do? You can write custom programs in Python to carry out the calculations that are normally not available on usual calculators.

Build a mobile app in Python

Most of the programs and applications these days are run on mobile phones and tablets. Very interesting applications can be written in Python that seamlessly work for iOS and Android.

You cannot write mobile apps using the regular IDE Python. You will need to use an open source library. Something like Kivy or BeeWare. Using these libraries you can create GUI applications for mobile phones. They allow you to write pure Python graphic applications. Some capabilities in BeeWare even allow you to build mobile apps with native capabilities.

Whereas you can use the Python GUI tools like Kivy and BeeWare to build a user interface, another reason why Python is increasingly becoming popular among mobile app developers is its ability to build APIs. Then these APIs can simply be accessed from mobile phones to build powerful mobile apps.

Search for text across multiple files using Python

Remember how above we suggested that you can build a web crawler using Python that goes through 200-300 (or even more) web pages to find instances of your private email ID appearing on them?

You can do something similar even on your own PC. Suppose, you are in the habit of taking notes in text files and you have been doing that for years. Maybe in one of your folders, you have thousands of files. Then one day you want to find a file in which you have talked about the Star Wars movie. Since you remember that you often talk about this movie, you want to find all the files where you have written something about the Star Wars movie. You can achieve this in Python.

You may wonder why you should write this function in Python when the Windows Explorer itself gives you the ability to search for files based on information contained within them.

This is about learning Python and making cool things with Python. If you create a small program that searches multiple text files to find a string of text, you will be learning about going through folders, going through file names, selecting individual files, reading the contents of the file and storing them in a variable, and then searching the variable for the string you want to find and then outputting the name of the file. Just imagine how much you can learn by writing just this small Python utility.

Update data in an Excel sheet using Python

Why would you update data in an Excel sheet using Python when you can open the sheet yourself to change the data? Good question.

One reason is to learn how you can manipulate data in Excel using Python – this can be a very important lesson.

The other reason is, there are many people who find it difficult to deal with rows and columns in Excel. Many older people who want to add data in Excel find it difficult to use the standard Excel interface.

For example, you want someone to be able to add names and phone numbers in an Excel sheet but you don’t want that person to be able to access the sheet directly. You create a GUI using Python and then using a Python script you can update the columns in the Excel sheet.

Another great example of using Excel with Python is creating an accounting software, something similar to track your expenses. You can have a small window written in Python GUI that accepts date, expense amount, the expense type and other details and then save these bits of information under appropriate columns in the Excel sheet.

Suppose, you have learnt some cool things you can make with Python. You have also learnt why Python is becoming increasingly popular. If you check out Google trends, you will be surprised that Python now is more popular than even C and C++. In terms of creating web applications, it is almost competing with PHP. Why so?

Many programmers prefer to call it a utilitarian language – you can quickly create utilities. It is not a very complex language to learn despite its amazing capabilities.

Another reason why Python has become so popular is that it has been adopted by Google. Many Google applications can be enhanced using Python and the search engine company itself has a vast repository of code snippets that you can use to improve your experience with Google products. Just as C# is promoted by Microsoft, Java by Sun Micro systems and PHP by Facebook, Python is promoted by Google.

Consequently, Python enjoys a large community. There is no dearth of programming code available in Python. Even if you don’t want to code from scratch, there are thousands of code snippets available on the Internet that you can download immediately and assemble a decent application.

So, fire up your favorite IDE or code editor and start making cool things in Python.

You Can Also Read About Sublime Text versus Notepad++.

Work From Home

We are hiring Programmers and Computer Science Students – Apply Here and Work From Home.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top