惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
NISL@THU
NISL@THU
E
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
K
Kaspersky official blog
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
S
Schneier on Security
G
GRAHAM CLULEY
The Hacker News
The Hacker News
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
爱范儿
爱范儿
P
Privacy International News Feed
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
S
Securelist
G
Google Developers Blog
The Last Watchdog
The Last Watchdog
Google Online Security Blog
Google Online Security Blog
美团技术团队
F
Fortinet All Blogs
小众软件
小众软件
Recorded Future
Recorded Future
V
Visual Studio Blog
B
Blog RSS Feed
H
Help Net Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Martin Fowler
Martin Fowler
Latest news
Latest news
Spread Privacy
Spread Privacy
H
Heimdal Security Blog

Uncategorized – 嘉嘉的博客

教你如何下载网上的视频 – 嘉嘉的博客 新Python项目:替换式密码 – 嘉嘉的博客 Flask:”Notes“项目 – 嘉嘉的博客 嘉嘉成尊 – 嘉嘉的博客 针对奚同志所受指控和表现的概述及审判 2(精简版)(同桌版) – 嘉嘉的博客
Python项目:面积计算器 – 嘉嘉的博客
justin文章作者 · 2026-06-01 · via Uncategorized – 嘉嘉的博客

这个就不多说了,开箱即用。没有函数。

print("欢迎使用面积计算器!")
print("(1)正方形 (2)长方形 (3)三角形 (4)平行四边形 (5)梯形")
lx = input("请输入类型:")
# 正方形
if lx == "1":
    print("正方形面积:边长*边长")
    bc = input("请输入边长:")
    bc = float(bc)
    mj = bc * bc
    print("面积:", mj)

# 长方形
if lx == "2":
    print("长方形面积:长*宽")
    c = input("请输入长:")
    c = float(c)
    k = input("请输入宽:")
    k = float(k)
    mj = c * k
    print("面积:", mj)

# 三角形
if lx == "3":
    print("三角形面积:底*高/2")
    d = input("请输入底:")
    d = float(d)
    g = input("请输入高:")
    g = float(g)
    mj = d * g / 2
    print("面积:", mj)

# 平行四边形
if lx == "4":
    print("平行四边形面积:底*高")
    d = input("请输入底:")
    d = float(d)
    g = input("请输入高:")
    g = float(g)
    mj = d * g
    print("面积:", mj)

# 梯形
if lx == "5":
    print("梯形面积:(上底+下底)*高")
    sd = input("请输入上底:")
    sd = float(sd)
    xd = input("请输入下底:")
    xd = float(xd)
    g = input("请输入高:")
    g = float(g)
    d = sd + xd
    mj = d * g
    print("面积:", mj)
运行效果