import csv


def count_covid_approval(pattern):
    """
    Cuenta el número de filas que contiene el patrón introducido.
    :param pattern: string
    :return: int
    """
    with open("data/covid_approval_polls.csv", "r") as csvfile:
        reader = csv.reader(csvfile)
        next(reader, None)
        rowcount = 0

        if pattern[0:4] == "http" and pattern[-4:] == ".pdf":

            for row in reader:
                if row[12] == pattern:
                    rowcount += 1
        else:

            for row in reader:
                if row[3] == pattern:
                    rowcount += 1
    return rowcount

import csv


def count_covid_approval(pattern):
    """
    Cuenta el número de filas que contiene el patrón introducido.
    :param pattern: string
    :return: int
    """
    with open("data/covid_approval_polls.csv", "r") as csvfile:
        reader = csv.reader(csvfile)
        next(reader, None)
        rowcount = 0

        if pattern[0:4] == "http" and pattern[-4:] == ".pdf":

            for row in reader:
                if row[12] == pattern:
                    rowcount += 1
        else:

            for row in reader:
                if row[3] == pattern:
                    rowcount += 1
    return rowcount

Cuenta el número de filas que contiene el patrón introducido.     :param pattern: string     :return: int