Adam = 95.5 Lisa = 85 Bart = 59
print Adam,Lisa,Bart
95.5 85 59
L = ['Adam = 95.5','Lisa = 85','Bart = 59']
print L
['Adam = 95.5','Lisa = 85','Bart = 59']
print Adam,Lisa,Bart
95.5 85 59
L = ['Adam = 95.5','Lisa = 85','Bart = 59']
print L
['Adam = 95.5','Lisa = 85','Bart = 59']
2016-11-09
最赞回答 / k2_18
import mathdef quadratic_equation(a, b, c): tmp = b * b - 4 * a * c if tmp < 0: return elif tmp == 0: return -b/(2 * a) else: x1= (-b + math.sqrt(tmp))/(2*a) x2= (-b - math.sqrt(tmp))/(2*a) return x1,x2p...
2016-11-09
s = 'python was started in 1989 by \"guido\". \n python is free and easy to learn.'
print s
感觉闹鬼一样,和其他同样的代码,敲进去总有一些小问题。
print s
感觉闹鬼一样,和其他同样的代码,敲进去总有一些小问题。
2016-11-09
x1 = 1
d = 3
n = 100
x100 = x1 + (100-1)*d
s = 100 * (x1 + x100)/2
print s
d = 3
n = 100
x100 = x1 + (100-1)*d
s = 100 * (x1 + x100)/2
print s
2016-11-09
#input code
print "hello, python"
print 'hello,', 'python'
单双引号不一样不一样.........
print "hello, python"
print 'hello,', 'python'
单双引号不一样不一样.........
2016-11-09
print (45678 + 0x12fd2)
print "Learn Python in imooc"
print 100<99
print 0xff==255
python2和3的print函数好像不一样,3 需要括号。
这里需要注意的应该是进制的写法,0x, 0是数字。
print "Learn Python in imooc"
print 100<99
print 0xff==255
python2和3的print函数好像不一样,3 需要括号。
这里需要注意的应该是进制的写法,0x, 0是数字。
2016-11-09
已采纳回答 / 慕粉4373732
字符串里面加上空格,空格会算字符串的一部分,但是在字符串外面有空格会被python自动过滤掉,比如:L=['test test','test' ,123 ,123]print L输出的结果是:['test test', 'test', 123, 123]除了字符串里面的空格,其他空格都被过滤掉了
2016-11-09