我有一些關於另一個for循環for-else循環的問題。所以這裏有一個例子: primelist = []
for p in range (2, x+1):
print 'in first for'
raw_input()
for i in range(2, p):
print 'in second for'
if p%i == 0:
我在這裏看到了有關使用gperf的答案,但是,我更願意根據我爲strings的域爲固定長度域創建的證明推出自己的答案<= 200根據我從wolfram的計算,我得到~7.9 x 10^374總排列。因此,我的思路是如果我有一個2048位散列函數(3.2 x 10^616)我應該能夠處理我需要處理的整個字符串。我的問題是,如何證明由於所有長度爲200或更小的字符串的限制,我最終生成的哈希實現將是完美
Python有所謂的一個方便的語言特性「換別的」(同樣,「同時,其他」),它是這樣的: for obj in my_list:
if obj == target:
break
else: # note: this else is attached to the for, not the if
print "nothing matched", target, "in