Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Project Work
Manage
Activity
Members
Labels
Plan
Issues
5
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fabian Del Villar
Project Work
Commits
693d07ce
Commit
693d07ce
authored
1 year ago
by
Fabian
Browse files
Options
Downloads
Patches
Plain Diff
Create test2-3.py
parent
15a44127
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test2-3.py
+18
-0
18 additions, 0 deletions
test2-3.py
with
18 additions
and
0 deletions
test2-3.py
0 → 100644
+
18
−
0
View file @
693d07ce
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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment