Python 17

作者: 秋雨夏磊 | 来源:发表于2022-07-18 15:06 被阅读0次

    #移动交换三个整数的数值

    #有三个变量:

    #num1 = 1

    #num2 = 2

    #num3 = 3

    #通过数值交换,输出为:

    #num1 = 2, num2 = 3, num3 =1

    num1 =1

    num2 =2

    num3 =3

    num4 = num1

    num1 = num2

    num2 = num3

    num3 = num4

    print('num1 = ', num1, '\nnum2 = ', num2, '\nnum3 = ', num3 )

    print(15 //2 **2 +15 %2 **2 )

    num1 =0.333 <1/3

    num2 =not (1 !=2)

    print(num1 == num2)

    print(int(input()) +float(input()))

    num1 ='True'

    num2 ='false'

    print(num1 != num2)

    num =123.45

    print('整数部分为:' +str(round(num)))

    print('整数部分为:' +str(num).split('.')[0])

    print('结果为:' +str(round(num, 1)))

    print('小数部分为:' +str(num -int(str(num).split('.')[0])))

    num1 =0b101

    num2 =0x1f

    num3 =13

    print(format(num1, 'd'))

    print(format(num2, 'd'))

    print(format(num3, 'd'))

    print(num1)

    str1 ='abc'

    str2 ='xyz'

    print(str1 + str2 > str2 +str1)

    FROM ='北校区'

    #from = '北校区'

    print(FROM)

    python =3

    print(python)

    相关文章

      网友评论

          本文标题:Python 17

          本文链接:https://www.haomeiwen.com/subject/qaarirtx.html