Discuss / Python / 练习

练习

Topic source

@颜小颜✔

#1 Created at ... [Delete] [Delete and Lock User]

#! /usr/bin/python3

n = 123                          #将字符串123指向给变量n

f = 456.789                   #将字符串456.789指向给变量f

s1 = 'hello,world'          #将字符串hello,world指向给变量s1

s2 = 'hellp,\'Adam\''      #将字符串hellp,'Adam'指向给变量s2

s3 = r'hello,“Bart”'        #将字符串'hello,“Bart”'指向给变量s3

s4 = r'''hello,

Lisa!'''                         #将字符串hello,\nLisa!指向给变量s4

A = [n,f,s1,s2,s3,s4]   #将变量n,f,s1,s2,s3,s4指向给变量A

for B in A:                   #将变量A重命名为B

    print(B)                   #输出B内容

#! /usr/bin/python3

print('n=123')

print('f=456.789')

print('s1=hello,world')

print('s2=hello,\'Adam\'')

print('s3=r\'hello,"Bart"\'')

print('s4=r\'\'\'hello,\nLisa!\'\'\'')

如有错误请大佬指出


  • 1

Reply