I have written some python scripts while learning the language.

It opens an url on the browser each 2 seconds.

import webbrowser
import time


print("This program started on "+time.ctime())
breaks = 3

while breaks > 0:
    time.sleep(2)
    webbrowser.open("https://youtu.be/4-JlcmCxIXU")
    breaks = breaks - 1

It changes the name of a list of files.

import os


def rename_files():
    photos_path = "/home/defnx/PycharmProjects/learn/photos"
    os.chdir(photos_path)
    file_list = os.listdir(photos_path)
    table = str.maketrans(dict.fromkeys("0123456789"))

    for file_name in file_list:
        os.rename(file_name, file_name.translate(table))


rename_files()

It draws a window.

import turtle


def main():
    window = turtle.Screen()
    window.bgcolor("black")
    drawer = turtle.Turtle()
    drawer.color("red")
    drawer.speed(20)
    drawer.shape("turtle")

    for i in range(1, 37):
        draw_square(drawer)
        drawer.right(10)

    window.exitonclick()


def draw_square(drawer):
    for i in range(1, 5):
        drawer.forward(200)
        drawer.right(90)


main()

It sends a sms via Twilio.

from twilio.rest import Client

account_sid = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
client = Client(account_sid, auth_token)

message = client.messages.create(
    to="+34456789123",
    from_="+34456789123",
    body="Hello from Python!")

print(message.sid)

It checks profanity in a text.

import urllib.request
import urllib.parse


def read_text():
    quotes = open("/home/defnx/PycharmProjects/learn/text")
    contents_of_file = quotes.read()
    quotes.close()
    check_profanity(contents_of_file)


def check_profanity(text_to_check):
    query = urllib.parse.urlencode({'q': text_to_check})
    url = "http://www.wdylike.appspot.com/?"+query
    connection = urllib.request.urlopen(url)
    output = connection.read()
    connection.close()

    if b"true" in output:
        print("Profanity Alert!!")
    elif b"false" in output:
        print("This document has no curse words!")
    else:
        print("Could not scan the document properly.")


read_text()