+ 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,"個水仙花數")

24th Oct 2018, 10:43 AM
yan yu
yan yu - avatar
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')
24th Oct 2018, 11:10 AM
Anna
Anna - avatar
+ 1
thank you for your answer
24th Oct 2018, 11:20 AM
yan yu
yan yu - avatar
+ 1
You're welcome 🙂
24th Oct 2018, 11:27 AM
Anna
Anna - avatar