Hướng dẫn python program to calculate area of triangle rectangle circle - chương trình python để tính diện tích hình tròn hình chữ nhật tam giác
Xem thảo luận Show Cải thiện bài viết Lưu bài viết Xem thảo luận Cải thiện bài viết Lưu bài viết Đọc Example: Input: shape name = "Rectangle" length = 10 breadth = 15 Output: Area: 150 Input: shape name = "Square" side = 10 Output: Area: 100 Approach: Bàn luận Chúng tôi sẽ thực hiện một chương trình Python để tính toán các khu vực của một số hình dạng toán học. Python3Trong chương trình này, chúng tôi sẽ yêu cầu người dùng nhập tên hình dạng. Nếu nó tồn tại trong chương trình của chúng tôi thì chúng tôi sẽ tiến hành tìm khu vực hình dạng đã nhập theo các công thức tương ứng của chúng. Nếu hình dạng đó không tồn tại thì chúng tôi sẽ in xin lỗi! Chúng ta không thể tìm thấy hình dạng này. thông báo trên màn hình. Dưới đây là việc thực hiện:
Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.3 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.4 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.6 = Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.8 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 def 0Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 def 223Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 0 1 2
Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 def 5= Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.8 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 def 0Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 calculate_area(name):\ 1def 3Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 calculate_area(name):\ 4= Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.6 calculate_area(name):\ 7 calculate_area(name):\ 8
Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.4 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 0= 9 2
Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 name 3= Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.8 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 def 0Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 name 9def 3Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 = 2= name 3calculate_area(name):\ 7 = 6
Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.4 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 1= Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.8 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 def 0Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 7def 3Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 0Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.08 2
Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.11 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 def 5= Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.8 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 def 0Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 if 6def 3Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 if 9= Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.01 calculate_area(name):\ 7 def 5calculate_area(name):\ 7
Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.17 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.4 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.20 = Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.8 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 def 0Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.26 def 3Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 0Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.42 2
Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.45 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.29 = Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.31 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.33 = Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.29 calculate_area(name):\ 7 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.20 calculate_area(name):\ 7 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.39
Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.51 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.4 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 def 5= Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.8 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 def 0Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.60 def 3Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 0Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.79 2
Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.82
Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.84 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.4 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 0Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.89 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.90 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 1= Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.8 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 def 0Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.69 def 3
Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.9 def 00Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.90 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.5 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.72 = def 5calculate_area(name):\ 7 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.05
Output: if Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.92 = = Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.95 Calculate Shape Area Enter the name of shape whose area you want to find: rectangle Enter rectangle's length: 10 Enter rectangle's breadth: 15 The area of rectangle is 150.4 Làm thế nào để bạn lập trình khu vực của một tam giác trong Python?Chương trình Python để tìm khu vực của một tam giác.. # Ba mặt của tam giác là A, B và C:. a = float (input ('nhập mặt đầu tiên:')). b = float (đầu vào ('nhập phía thứ hai:')). c = float (đầu vào ('nhập phía thứ ba:')). # Tính toán semi-perimet .. s = (a + b + c) / 2 .. # Tính diện tích .. diện tích = (s*(s-a)*(s-b)*(s-c)) ** 0,5 .. Làm thế nào để bạn tìm thấy khu vực của một vòng tròn trong Python?Phương pháp tìm diện tích của vòng tròn đã cho bằng Python.. Nhập toán như M .. Bán kính = Float (đầu vào ("Vui lòng nhập bán kính của vòng tròn đã cho:")). Area_of_the_circle = m.pi * Bán kính * Bán kính .. in ("Khu vực của vòng tròn đã cho là:", area_of_the_circle). Làm thế nào để bạn giải quyết khu vực trong Python?Chương trình Python để tìm một khu vực của một hình chữ nhật.. Đầu tiên, chúng tôi sẽ lấy đầu vào từ người dùng về chiều dài và chiều rộng bằng cách sử dụng hàm input () .. Bây giờ, chúng tôi sẽ tính diện tích của một hình chữ nhật bằng cách sử dụng vùng công thức = l * b .. Cuối cùng, in khu vực của một hình chữ nhật để xem đầu ra .. |