Skip to content
Snippets Groups Projects
Commit 693d07ce authored by Fabian's avatar Fabian
Browse files

Create test2-3.py

parent 15a44127
No related merge requests found
def create_rectangle():
# Prompt for the length and width of the rectangle
width = float(input("Enter the width of the rectangle: "))
height = float(input("Enter the height of the rectangle: "))
# Create the SVG code for the rectangle
svg_code = f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}">'
svg_code += f'<rect x="0" y="0" width="{width}" height="{height}" fill="none" stroke="red" stroke-width="0.05" />'
svg_code += '</svg>'
# Write the SVG code to a file
with open('rectangle.svg', 'w') as file:
file.write(svg_code)
print("Rectangle SVG file 'rectangle.svg' has been generated.")
# Call the function to create the rectangle
create_rectangle()
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment