5 Interesting Tasks to Automate with Python


Mamta Mitali

Jun 22, 2021
5 Interesting Tasks to Automate with Python

As an individual we have a lot of work to do daily out of which some are repetitive in nature, some are not. What if we tell you that you can actually knock off your repetitive tasks in no time. You just need Python.

Python is an incredibly powerful and flexible open-source language that is used almost everywhere: from web development to game development, from artificial intelligence to data science, from image processing to text processing, from software development to operating systems, and much more. 

Because of its flexibility, and versatility – extended by its extensive library – Python is an amazing tool. You can use Python to automate all your repetitive tasks and focus on those tasks which need our attention. 

Let’s have a look at five Interesting Python-automated tasks:


    1. Task Reminder

    You may use the script below to set a reminder on your Mac or windows.

    First, import the following dependency.

    import time

    Then, in the command line, write code:

    print("What shall I remind you about?")

    text = str(input())

    print("In how many minutes?")

    local_time = float(input())

    local_time = local_time * 60

    time.sleep(local_time)

    print(text)


      2. Language Translator

      You may use the script below to install on your Mac or windows.

      pip install translate

      Then, in the command line, write code:

      # English to German

      from translate import Translator

      translator= Translator(to_lang="German")

      translation = translator.translate("Good Morning!")

      print translation


      # Between Any Two Languages

      from translate import Translator

      translator= Translator(from_lang="german",to_lang="spanish")

      translation = translator.translate("Guten Morgen")

      print translation


        3. Converting Currencies

        All we have to do now is install the library as shown below.

        pip install --user currencyconverter

        This installation should add a currency converter to our $PATH, allowing us to perform a conversion by simply typing the following, as shown in the example.

        currency_converter 1 USD --to EUR


          4. Sending Emails

          All we have to do now is import the library as shown below.

          import smtplib

          Then, in the command line, write code:

          s = smtplib.SMTP('smtp.gmail.com', 587)

          s.starttls()

          s.login("sender_email_id", "sender_email_id_password")

          # message to be sent

          message = "Message_you_need_to_send"

          # sending the mail

          s.sendmail("sender_email_id", "receiver_email_id", message)

          s.quit()


            5. Basic calculator

            In day to day life, calculation is everywhere so based on the user input, we can perform basic arithmetic operations such as addition, subtraction, multiplication, and division.

            Then, in the command line, write code:

            # Function to add two numbers 

            def add(num1, num2):

                return num1 + num2

              

            # Function to subtract two numbers 

            def subtract(num1, num2):

                return num1 - num2

              

            # Function to multiply two numbers

            def multiply(num1, num2):

                return num1 * num2

              

            # Function to divide two numbers

            def divide(num1, num2):

                return num1 / num2

              

            print("Please select operation -\n" \

                    "1. Add\n" \

                    "2. Subtract\n" \

                    "3. Multiply\n" \

                    "4. Divide\n")  

              

            # Take input from the user 

            select = int(input("Select operations form 1, 2, 3, 4 :"))

            number_1 = int(input("Enter first number: "))

            number_2 = int(input("Enter second number: "))

              

            if select == 1:

                print(number_1, "+", number_2, "=",

                                add(number_1, number_2))

              

            elif select == 2:

                print(number_1, "-", number_2, "=",

                                subtract(number_1, number_2))

              

            elif select == 3:

                print(number_1, "*", number_2, "=",

                                multiply(number_1, number_2))

              

            elif select == 4:

                print(number_1, "/", number_2, "=",

                                divide(number_1, number_2))

            else:

                print("Invalid input")



            Conclusion

            Python is a powerful language that will make you more productive and efficient the more you study and practice it. We are really happy to share these interesting automation tasks with you, and we hope you find them useful and interesting as well.


            Perfect eLearning offers basic & advanced coding tutorials for people who want to learn how to code.

            Topics:

            1. Introducing the best basic coding courses online.

            2. The benefits of taking coding courses online.

            3. The top three coding courses online that you should check out.

            4. How to get started with coding courses online.

            5. The best way to learn to code online.

            6. The future of coding courses online.

            7. Introducing the basics of coding

            8. The benefits of learning to code

            9. Types of coding tutorials available

            10. How to get started with coding

            If you're looking to learn to code, there are a variety of ways you can go about it. But, if you're looking for the easiest and most efficient way to learn, then these 5 steps are the way to go:

            1. Choose the right language.

            2. Use coding boot camps.

            3. Use online coding communities.

            4. Use online coding tutorials.

            5. Use online coding examples.

            For more details, you can talk to our experts.

            Perfect eLearning

            Learn & Grow!

            Hey it's Sneh!

            What would i call you?

            Great !

            Our counsellor will contact you shortly.