Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to calculate the area and perimeter of a shape in python

Shape = input("what shape do you have: ")

if Shape == 'square':
	Kind = input("you want the area perimeter : ")
	if Kind == 'area':
		width = int(input("What's the width of the area? : "))
		height = int(input("What's the height of the area? : "))
		calculation = width * height
		print(f"It's {calculation}")
	if Kind == 'perimeter':
		width = int(input("What's the width of the perimeter? : "))
		calculation = width * 4
		print(f"It's {calculation}")
if Shape == 'rectangle':
	Kind = input("you want the area perimeter : ")
	if Kind == 'area':
		width = int(input("What's the width of the area? : "))
		height = int(input("What's the height of the area? : "))
		calculation = width * height
		print(f"It's {calculation}")
	if Kind == 'perimeter':
		width = int(input("What's the width of the area? : "))
		height = int(input("What's the height of the area? : "))
		calculation = width * 2 + height * 2
		print(f"It's {calculation}")
		
Comment

PREVIOUS NEXT
Code Example
Python :: python tk highlightthicknes 
Python :: type hinting with default value python 
Python :: why does my function print none 
Python :: python package for facial emotion recognition 
Python :: how to prefix numbers with zero in python 
Python :: how to check if the update_one success in flask 
Python :: pd.generate_date 
Python :: python data manipulation_16.06.2022 
Python :: Filling or replacing the missing values with mode 
Python :: django wsgi application could not be loaded error importing module 
Python :: how to import modules from upper or previous dir in py 
Python :: Select non-NaN rows and replace column value 
Python :: Python 0 evaluates to False 
Python :: replace python enter number of characters 
Python :: 5.2.5: Counting 10 to 100 by ... 
Python :: fichier python pour brython 
Python :: np choose explain 
Python :: provide a script that prints the sum of every even numbers in the range [0; 100]. 
Python :: django model meta ordering multiple ordering 
Python :: name =input ("hello how are you ") if name==("good"): print ("Thats nice") else print("stfu") 
Python :: python output parameter 
Python :: dashbars detect first loop 
Python :: difference in django project view and app view 
Python :: djangobook.com jwd django restfremwork plugin 
Python :: Merge the values for each key using an associative and commutative reduce function. 
Python :: Limits the result count to the number specified 
Python :: jwt authentication python flask 
Python :: vitalik buterin age 
Python :: python class definition 
Python :: qt platform plugin could not be initialized stackoverflow 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =