Task1代码:
a=input('please input the value of a\n');
b=input('please input the value of b\n');
print('a*b=',int(a)*int(b));
Task2代码:
print(r''' 123
456.789
'Hello, world'
'Hello, \'Adam\''
r'Hello, "Bart"'
''');
print( 'r\'\'\'Hello,\nLisa!\'\'\'');
Task3代码:
# -*- coding: utf-8 -*-
s1 = 72
s2 = 85
r = 100*(s2-s1)/s1
print('%.1f%%' % r)
Task4代码:
# -*- coding: utf-8 -*-
L = [
['Apple', 'Google', 'Microsoft'],
['Java', 'Python', 'Ruby', 'PHP'],
['Adam', 'Bart', 'Lisa']
];
for i in range(len(L)):
for j in range(len(L)):
print(L[j]);
心得体会:明白了三种最常用的编码格式的区别,Python程序编写一定要注重缩进。
|
|