[英]How to hash a string into 4 digits with values above 1000 and below 9999?
Any method to generate a hash of some string into a 4 digit int that's > 1000
and <= 9999
?将某个字符串的 hash 生成为
> 1000
且<= 9999
的 4 位整数的任何方法?
From barmar's idea:从barmar的想法:
datainput = input("Enter a string : ")
hashoutput = (hash(datainput) % 8999) + 1001
print(hashoutput)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.