Gráficos SVG - Ficheros - Soluciones (1)

Se ofrecen a continuación unas posibles soluciones de los ejercicios de SVG Ficheros (1).

Gráficos SVG Ficheros (1) - 1 - Puntos

SVG Ficheros (1) 1 1
import webbrowser


def main():
    ruta = "svg-ficheros-1-1-1.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 1-1. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-10 -10 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <circle cx="300" cy="0"   r="5" fill="black" />', file=fichero)
        print('    <circle cx="0"   cy="0"   r="5" fill="blue" />', file=fichero)
        print('    <circle cx="0"   cy="300" r="5" fill="green" />', file=fichero)
        print('    <circle cx="300" cy="300" r="5" fill="red" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 1 2
import webbrowser


def main():
    ruta = "svg-ficheros-1-1-2.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 1-2. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-10 -10 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <circle cx="300" cy="0"   r="5" fill="red" />', file=fichero)
        print('    <circle cx="150" cy="0"   r="5" fill="green" />', file=fichero)
        print('    <circle cx="150" cy="150" r="5" fill="black" />', file=fichero)
        print('    <circle cx="300" cy="150" r="5" fill="blue" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 1 3
import webbrowser


def main():
    ruta = "svg-ficheros-1-1-3.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 1-3. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-10 -10 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <circle cx="0"   cy="0"   r="5" fill="red" />', file=fichero)
        print('    <circle cx="100" cy="100" r="5" fill="black" />', file=fichero)
        print('    <circle cx="200" cy="200" r="5" fill="blue" />', file=fichero)
        print('    <circle cx="300" cy="300" r="5" fill="green" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 1 4
import webbrowser


def main():
    ruta = "svg-ficheros-1-1-4.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 1-4. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-10 -10 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <circle cx="0"   cy="150" r="5" fill="#000" />', file=fichero)
        print('    <circle cx="75"  cy="150" r="5" fill="#333" />', file=fichero)
        print('    <circle cx="150" cy="150" r="5" fill="#666" />', file=fichero)
        print('    <circle cx="225" cy="150" r="5" fill="#999" />', file=fichero)
        print('    <circle cx="300" cy="150" r="5" fill="#AAA" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 1 5
import webbrowser


def main():
    ruta = "svg-ficheros-1-1-5.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 1-5. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-10 -10 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <circle cx="150" cy="50"  r="25" fill="blue" />', file=fichero)
        print('    <circle cx="150" cy="100" r="25" fill="red" />', file=fichero)
        print('    <circle cx="150" cy="150" r="25" fill="black" />', file=fichero)
        print('    <circle cx="150" cy="200" r="25" fill="green" />', file=fichero)
        print('    <circle cx="150" cy="250" r="25" fill="purple" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 1 6
import webbrowser


def main():
    ruta = "svg-ficheros-1-1-6.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 1-6. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-10 -10 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <circle cx="150" cy="150" r="150" fill="black" />', file=fichero)
        print('    <circle cx="150" cy="150" r="125" fill="white" />', file=fichero)
        print('    <circle cx="150" cy="150" r="100" fill="black" />', file=fichero)
        print('    <circle cx="150" cy="150" r="75"  fill="white" />', file=fichero)
        print('    <circle cx="150" cy="150" r="50"  fill="black" />', file=fichero)
        print('    <circle cx="150" cy="150" r="25"  fill="white" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()

Gráficos SVG Ficheros (1) - 2 - Líneas

SVG Ficheros (1) 2 1
import webbrowser


def main():
    ruta = "svg-ficheros-1-2-1.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 2-1. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-160 -160 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <line x1="0"    y1="-150" x2="0"   y2="150" stroke="green" stroke-width="1" />', file=fichero)
        print('    <line x1="-150" y1="0"    x2="150" y2="0"   stroke="green" stroke-width="1" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 2 2
import webbrowser


def main():
    ruta = "svg-ficheros-1-2-2.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 2-2. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-160 -160 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <line x1="0"    y1="-75"  x2="150" y2="-75" stroke="blue" stroke-width="1" />', file=fichero)
        print('    <line x1="-150" y1="75"   x2="0"   y2="75"  stroke="blue" stroke-width="1" />', file=fichero)
        print('    <line x1="75"   y1="0"    x2="75"  y2="150" stroke="blue" stroke-width="1" />', file=fichero)
        print('    <line x1="-75"  y1="-150" x2="-75" y2="0"   stroke="blue" stroke-width="1" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 2 3
import webbrowser


def main():
    ruta = "svg-ficheros-1-2-3.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 2-3. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-160 -160 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <line x1="-150" y1="0"   x2="0"   y2="-150" stroke="purple" stroke-width="1" />', file=fichero)
        print('    <line x1="-150" y1="150" x2="150" y2="-150" stroke="purple" stroke-width="1" />', file=fichero)
        print('    <line x1="0"    y1="150" x2="150" y2="0"    stroke="purple" stroke-width="1" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 2 4
import webbrowser


def main():
    ruta = "svg-ficheros-1-2-4.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 2-4. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-160 -160 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <line x1="-150" y1="-150" x2="-50" y2="-50" stroke="chocolate" stroke-width="1" />', file=fichero)
        print('    <line x1="150"  y1="-150" x2="50"  y2="-50" stroke="chocolate" stroke-width="1" />', file=fichero)
        print('    <line x1="-150" y1="150"  x2="-50" y2="50"  stroke="chocolate" stroke-width="1" />', file=fichero)
        print('    <line x1="150"  y1="150"  x2="50"  y2="50"  stroke="chocolate" stroke-width="1" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 2 5
import webbrowser


def main():
    ruta = "svg-ficheros-1-2-5.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 2-5. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-160 -160 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <line x1="-150" y1="50"  x2="150" y2="50"   stroke="steelblue" stroke-width="1" />', file=fichero)
        print('    <line x1="-150" y1="-50" x2="150" y2="-50"  stroke="steelblue" stroke-width="1" />', file=fichero)
        print('    <line x1="-50"  y1="150" x2="-50" y2="-150" stroke="steelblue" stroke-width="1" />', file=fichero)
        print('    <line x1="50"   y1="150" x2="50"  y2="-150" stroke="steelblue" stroke-width="1" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 2 6
import webbrowser


def main():
    ruta = "svg-ficheros-1-2-6.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 2-6. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-160 -160 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <line x1="-50" y1="-150" x2="150"  y2="50"  stroke="teal" stroke-width="1" />', file=fichero)
        print('    <line x1="50"  y1="-150" x2="-150" y2="50"  stroke="teal" stroke-width="1" />', file=fichero)
        print('    <line x1="-50" y1="150"  x2="150"  y2="-50" stroke="teal" stroke-width="1" />', file=fichero)
        print('    <line x1="50"  y1="150"  x2="-150" y2="-50" stroke="teal" stroke-width="1" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()

Gráficos SVG Ficheros (1) - 3 - Rectángulos, polígonos

SVG Ficheros (1) 3 1
import webbrowser


def main():
    ruta = "svg-ficheros-1-3-1.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 3-1. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-10 -10 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <rect x="0"   y="75" width="150" height="150" stroke="black" stroke-width="1" fill="white" />', file=fichero)
        print('    <rect x="150" y="75" width="150" height="150" stroke="black" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="75"  cy="150" r="50" stroke="black" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="225" cy="150" r="50" stroke="black" stroke-width="1" fill="white" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 3 2
import webbrowser


def main():
    ruta = "svg-ficheros-1-3-2.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 3-2. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-10 -10 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <rect x="0"  y="0"   width="300" height="300" stroke="blue" stroke-width="1" fill="white" />', file=fichero)
        print('    <rect x="50" y="100" width="200" height="200" stroke="blue" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="150" cy="50" r="50" stroke="blue" stroke-width="1" fill="white" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 3 3
import webbrowser


def main():
    ruta = "svg-ficheros-1-3-3.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 3-3. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-10 -10 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <circle cx="75"  cy="75"  r="75" stroke="orangered" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="225" cy="75"  r="75" stroke="orangered" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="75"  cy="225" r="75" stroke="orangered" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="225" cy="225" r="75" stroke="orangered" stroke-width="1" fill="white" />', file=fichero)
        print('    <rect x="75" y="75" width="150" height="150" stroke="orangered" stroke-width="1" fill="none" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 3 4
import webbrowser


def main():
    ruta = "svg-ficheros-1-3-4.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 3-4. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-10 -10 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <polygon points="0,150 75,225 225,75 300,150 225,225 75,75" stroke="indigo" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="150" cy="75"  r="50" stroke="indigo" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="150" cy="225" r="50" stroke="indigo" stroke-width="1" fill="white" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 3 5
import webbrowser


def main():
    ruta = "svg-ficheros-1-3-5.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 3-5. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-10 -10 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <polygon points="  0,100 100,0 300,200 200,300" stroke="seagreen" stroke-width="1" fill="none" />', file=fichero)
        print('    <polygon points="300,100 200,0   0,200 100,300" stroke="seagreen" stroke-width="1" fill="none" />', file=fichero)
        print('    <circle cx="150" cy="150" r="50" stroke="seagreen" stroke-width="1" fill="white" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()
SVG Ficheros (1) 3 6
import webbrowser


def main():
    ruta = "svg-ficheros-1-3-6.html"

    with open(ruta, mode="w", encoding="utf-8") as fichero:
        print("<!DOCTYPE html>", file=fichero)
        print('<html lang="es">', file=fichero)
        print("<head>", file=fichero)
        print('  <meta charset="utf-8">', file=fichero)
        print("  <title>Ficheros (1) 3-6. SVG. Ejercicios. Python</title>", file=fichero)
        print('  <meta name="viewport" content="width=device-width, initial-scale=1.0">', file=fichero)
        print("</head>", file=fichero)
        print("", file=fichero)
        print("<body>", file=fichero)
        print('  <svg version="1.1" xmlns="http://www.w3.org/2000/svg"', file=fichero)
        print('    width="320" height="320" viewBox="-10 -10 320 320"', file=fichero)
        print('    style="border: black 1px solid">', file=fichero)
        print('    <polygon points="0,150 150,0 300,150 150,300" stroke="sienna" stroke-width="1" fill="none" />', file=fichero)
        print('    <circle cx="30"  cy="30"  r="30" stroke="sienna" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="270" cy="30"  r="30" stroke="sienna" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="150" cy="90"  r="30" stroke="sienna" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="90"  cy="150" r="30" stroke="sienna" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="210" cy="150" r="30" stroke="sienna" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="150" cy="210" r="30" stroke="sienna" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="30"  cy="270" r="30" stroke="sienna" stroke-width="1" fill="white" />', file=fichero)
        print('    <circle cx="270" cy="270" r="30" stroke="sienna" stroke-width="1" fill="white" />', file=fichero)
        print("  </svg>", file=fichero)
        print("</body>", file=fichero)
        print("</html>", file=fichero)

    webbrowser.open(ruta)


if __name__ == "__main__":
    main()