+ 1
Help me! Daffodil number don't know where it is wrong
print("水仙花數 : ") counter =0 for i in range(100,1000,1): hundred = int(i/100) ten = int(i/10%10) one = int(i%10) if i == hundred ** 3+ten**3+one**3: print(i,"是水仙花數") counter = counter +1 print("100~999間共有",counter,"個水仙花數")
3 Respuestas
+ 6
You need to include the following lines to support Chinese characters:
import sys, codecs
sys.stdout = codecs.getwriter('utf-16')(sys.stdout.buffer, 'strict')
+ 1
thank you for your answer
+ 1
You're welcome 🙂