李白壶里有多少酒,用Python编程解决?

Python013

李白壶里有多少酒,用Python编程解决?,第1张

#李白街上走,提壶去买酒,遇店加一倍,见花喝一斗,三遇店和花,喝光壶中酒,

# 试问壶中原有酒几斗?

j=0

for i in range(3):

  j=j+1

  j=j/2

print('壶中原有酒{}斗。'.format(j))

def main():

句子=原始输入('句子')

words = sentence.split()

临时= " "

对于范围内的idx(len(单词)):

temp = words[idx][0]。上部()

temp = words[idx][1:]

words[idx] = temp

临时= " "

返回“”。加入(单词)