• demo01_算术运算符


    • 算术运算符
    '''
    @note: https://www.runoob.com/python/python-operators.html
    @author: xilh
    @since: 20200124
    '''
    
    a = 21
    b = 10
    c = 0
     
    c = a + b
    print("a + b 的值为:", c)
     
    c = a - b
    print("a - b 的值为:", c)
     
    c = a * b
    print("a * b 的值为:", c)
     
    c = a / b
    print("a / b 的值为:", c)
     
    c = a % b
    print("a % b 的值为:", c)
     
    # 修改变量 a 、b 、c
    a = 2
    b = 3
    c = a**b 
    print("a**b  的值为:", c)
     
    a = 10
    b = 5
    c = a//b 
    print("a//b  的值为:", c)
    • 运行结果
    a + b 的值为: 31
    a - b 的值为: 11
    a * b 的值为: 210
    a / b 的值为: 2.1
    a % b 的值为: 1
    a**b  的值为: 8
    a//b  的值为: 2
  • 相关阅读:
    9.17 HTML CSS
    9.16
    9.15
    9.14
    9.13
    9.12
    9.11
    9.10
    9.9
    9.8
  • 原文地址:https://www.cnblogs.com/xiluhua/p/12237755.html
Copyright © 2020-2023  润新知