Jump to content
  • Hello visitors, welcome to the Hacker World Forum!

    Red Team 1949  (formerly CHT Attack and Defense Team) In this rapidly changing Internet era, we maintain our original intention and create the best community to jointly exchange network technologies. You can obtain hacker attack and defense skills and knowledge in the forum, or you can join our Telegram communication group to discuss and communicate in real time. All kinds of advertisements are prohibited in the forum. Please register as a registered user to check our usage and privacy policy. Thank you for your cooperation.

    TheHackerWorld Official

Python语言基础

 Share


KaiWn

Recommended Posts

  • 实例01 根据身高、体重计算BMI指数

     运用公式  BMI=体重/(身高 × 身高)”
    点击查看代码
     
    运行结果

    image

    实例02 输出007号坦克

    因为该字符画有多行,所以需要三引号作为字符串的界定符。
    点击查看代码
     
    运行结果

    image

    实例03 模拟超市抹零结账行为

    首先累加每个商品的金额,计算总价,并转换为字符串输出,再应用int()函数将浮点型变量转换
    为整型,从而实现抹零,并转换为字符串输出。
    点击查看代码
     
    运行结果

    image

    实例04 计算学生成绩的分差和平均分

    运算符的运用
    点击查看代码
     
    运行结果

    image

    实例05 使用比较运算符比较大小关系

    点击查看代码
     
    运行结果

    image

    实例06 参加手机店的打折活动

    点击查看代码
     
    运行结果

    image

    image

    实例07 根据身高、体重计算BMI指数(改进版)

    使用input()函数输入
    点击查看代码
     
    运行结果

    image
    image

Link to post
Link to comment
Share on other sites

 Share

discussion group

discussion group

    You don't have permission to chat.
    • Recently Browsing   0 members

      • No registered users viewing this page.
    ×
    ×
    • Create New...