Python Workout
Published in

Python Workout

Workout #25: XML Generator

Write a function, myxml, that allows you to create simple XML output. The output from the function will always be a string. The function can be invoked in a number of ways, as shown in table 6.3.

Table 6.3 Calling myxml

Call  |   Return valuemyxml('foo') |  <foo></foo>myxml('foo', 'bar') |  <foo>bar</foo>myxml('foo', 'bar', a=1, b=2, c=3) | <foo a="1" b="2" c="3">bar</foo>






Python problems and solutions, follows the text “Python Workout” by Reuven M. Lerner.

Recommended from Medium

“Edge Computing ” Science-Research, February 2022, Week 3 — summary from Astrophysics Data System…

TryHackMe: Complete Beginner Path

How to keep a Valorant Tournament Cheat free

Swift Known Unknowns: Is swift force unwrapping bad?

Are you tired of Java Frameworks Yet?

Coderpad — Java Example with Unit Tests

Simple KPI dashboard

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abish Pius

Abish Pius

Data Science Professional who teaches with unflashy, simple to understand python code.

More from Medium

How to upload code to Github?

CSV to JSON converter in 10 lines of code

Automating Startup Actions with Python

How to Build a Repository in Git and GitHub