Python Forum
Return all Values which can divided by 9
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Return all Values which can divided by 9
#1
Hi all

i am searching for a funtion or simmilar solution that returns if a value can be divided by 9 without rest.

I was trying with Modulo operation but this didnt give me the correct result

for number in range(1, 3500):
    if(number % 9 != 0):
        print(number)
Anybody who might help me out with guiding to the correct Solution or giving a hint what i am searching for ?

Thanks in Advancee
Reply
#2
I can give you a hint. If a number n is divisible by m without rest, n % m = 0.
Try the following examples
9 % 9
18 % 9
27 % 9
Hope this helps.
Reply
#3
(Mar-16-2020, 12:10 PM)scidam Wrote: I can give you a hint. If a number n is divisible by m without rest, n % m = 0.
Try the following examples
9 % 9
18 % 9
27 % 9
Hope this helps.

Yep, thx a lot, didnt work directly but

for number in range(1, 3000):
    if(number % 9 == 0):
        print(number)
did the trick
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need to return 2 values from 1 DF that equals another DF cubangt 5 593 Oct-21-2023, 02:45 PM
Last Post: deanhystad
  [Solved]Return values from npyscreen Extra 2 1,093 Oct-09-2022, 07:19 PM
Last Post: Extra
  Parallelism with return values Plexian 7 1,426 Aug-14-2022, 09:33 AM
Last Post: Plexian
  please help with classes and return values jamie_01 5 1,751 Jan-17-2022, 02:11 AM
Last Post: menator01
  Need to parse a list of boolean columns inside a list and return true values Python84 4 2,036 Jan-09-2022, 02:39 AM
Last Post: Python84
  Function - Return multiple values tester_V 10 4,319 Jun-02-2021, 05:34 AM
Last Post: tester_V
  Sume Every 10 element in the list and Divided of Sum quest_ 7 2,969 Nov-27-2020, 10:58 AM
Last Post: perfringo
  Function to return list of all the INDEX values of a defined ndarray? pjfarley3 2 1,919 Jul-10-2020, 04:51 AM
Last Post: pjfarley3
  What is the best way to return these 4 integer values? Pedroski55 4 2,491 Apr-13-2020, 09:54 PM
Last Post: Pedroski55
  Return values for use outside of function willowman 1 1,653 Apr-13-2020, 07:00 AM
Last Post: buran

Forum Jump:

User Panel Messages

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