Question: #Assaignment 1 . py # Get the user's name name = input ( Please enter your name: ) print ( Hello World,

#Assaignment1.py
# Get the user's name
name = input("Please enter your name: ")
print("Hello World, from "+ name +"!")
# Print an additional message
print("I am very excited to learn coding!")
#Assaignemnt 2.py
#get user input
user_input = input("Enter a number: ")
# Calculate the square of the input number
square = float(user_input)**2
# Print the square
print("Square of the input number:", square)
# Determine if the input is a triangle or not
shape_input = input("Enter a shape (triangle or another shape): ")
if shape_input.lower()== "triangle":
# If the shape is a triangle, calculate the area
base = float(input("Enter the base of the triangle: "))
height = float(input("Enter the height of the triangle: "))
area_of_triangle =(height * base)/2
print(f"The area of the triangle is: {area_of_triangle}")
elif shape_input.lower()== "square":
# If the shape is a square, calculate and print the square again
square = float(user_input)**2
print("Square of the input number:", square)
else:
# If the shape is neither triangle nor square, print a message
print("Unsupported shape. Please enter either 'triangle' or 'square'.") turned these codes into loop python

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!