Python Forum
HELP - Writing code returning True or False
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HELP - Writing code returning True or False
#2
Think about it: you only want to return True if no number plus it's own digits equals n. So you need to check all of the numbers up to n-1 before returning True. So return True (you don't need the parentheses) should come after the loop, not inside it as you have it now.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: HELP - Writing code returning True or False - by ichabod801 - Oct-30-2018, 02:38 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Can't stop if statement from executing even though False + Messy code? monkeydesu 1 1,709 Oct-17-2022, 05:46 AM
Last Post: deanhystad
  I need help writing this code for string properties and methods hannah71605 4 4,216 Mar-22-2021, 12:36 PM
Last Post: menator01
  Need help in Code for Writing View Functions in Flask - Python Web Framework ashishsme14 2 4,076 May-22-2020, 03:43 AM
Last Post: snippsat
  Speed of progress of writing code Johno 2 3,649 Jan-19-2018, 01:56 AM
Last Post: dwiga
  How do you create a true/false response? adamgobin 2 4,680 Jan-08-2018, 06:41 AM
Last Post: squenson
  Problem writing code with my pseudocode MattWilk97 1 3,565 Aug-29-2017, 01:54 AM
Last Post: ichabod801
  Need Help with writing this code!? r6lay 7 7,462 Feb-13-2017, 10:03 AM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020