Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#Assaignment 1 . py # Get the user's name name = input ( Please enter your name: ) print ( Hello World,
#Assaignmentpy
# Get the user's name
name inputPlease enter your name:
printHello World, from name
# Print an additional message
printI am very excited to learn coding!"
#Assaignemnt py
#get user input
userinput inputEnter a number:
# Calculate the square of the input number
square floatuserinput
# Print the square
printSquare of the input number:", square
# Determine if the input is a triangle or not
shapeinput inputEnter a shape triangle or another shape:
if shapeinput.lower "triangle":
# If the shape is a triangle, calculate the area
base floatinputEnter the base of the triangle:
height floatinputEnter the height of the triangle:
areaoftriangle height base
printfThe area of the triangle is: areaoftriangle
elif shapeinput.lower "square":
# If the shape is a square, calculate and print the square again
square floatuserinput
printSquare of the input number:", square
else:
# If the shape is neither triangle nor square, print a message
printUnsupported shape. Please enter either 'triangle' or 'square'." turned these codes into loop python
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started