https://blog.csdn.net/qq_33324608/article/details/78866760 无意中看到一个写10位随机数的方法,很有想法,然后就从学了一下随机数,相关东西都记一下 直接上代码 import random print ''.join(str(random.choice(range(10))) for _ in range(10)) 解析: ”.join():作用是将引号里内容加入到括号里元素之间,是字符串操作函数.引号里元素为字符串或数字,就是写啥就是啥,
本题来自 Project Euler 第13题:https://projecteuler.net/problem=13 # Project Euler: Problem 13: Large sum # Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. # Answer: 5537376230 numbers = '''371072875339021027987979982