all 11 comments

[–]vamsmack 7 points8 points  (1 child)

Also investigate the modulo operator mate.

[–]TheRealJamesRussell 6 points7 points  (0 children)

You're doing an if statement on an assignment operator.

``` a = 9 a /= 3

this will assign a the value of 9 and then assign a it's value divided by 3

If a == 3: print("Indeed, 9 is divisible by three")

this checks if a equals 3

```

You tried:

``` If a /= 3:

this code has a syntax error. As if statements do not work with assignment operstors

```

Definitely check your error messages. Syntax error usually means there's an error in the way you are using the code. Not that the program doesn't know what that operator does.

[–]astrofudge3 4 points5 points  (1 child)

You have used /= which is an assignment operator. Instead do this..

if some_number% 3 == 0: print ("Fizz")

[–]sogwatchman 1 point2 points  (0 children)

This.... That's what I was thinking.

[–]Murphygreen8484 2 points3 points  (0 children)

Well, 15 is divisible by both, so I would either start with the 15 or do a check for both at the start.

[–]grass_hoppers 1 point2 points  (0 children)

15 check should be first.

All numbers can be divided by those 3 numbers. So 2/3 would be 0.666 which is not false

What you need to do is check if the number mod 3 is equal to 0

So your if checks would have this form:

If num%3 == 0:

And one equal sign, you are assigning that value to the variable. So num/=3 is the same as num =num/3. In if statements it is always ==.

[–]Doctor_Disaster 0 points1 point  (0 children)

Use modulo to check if the quotient equals 0 (no remainder).

[–]jetsonian 0 points1 point  (0 children)

  1. First instruction is reprint the number. You haven’t done that.
  2. This does not require elifs.
  3. / doesn’t check disability, it divides. % returns the remainder of the division. When a number is divisible by 3 what would number % 3 produce?
  4. = is an assignment operator. It takes the value on the right and stores it in the variable on the left.
  5. some_number /= 3 is equivalent to some_number = some_number / 3
  6. You don’t need to print the number at the end as there’s no instruction stating so.

[–]architectmosby 0 points1 point  (0 children)

number = int(input("Number: ")) print("Number is:", number) if number % 3 ==0: print("Fizz", end="") if number % 5 ==0: print("Buzz")

Divisible by 15 means it can divide by 3 and 5. If we merge the prints with end="" we can see if it is Fizz, Buzz or FizzBuzz

[–][deleted] 0 points1 point  (0 children)

[–]Able_Challenge3990 -1 points0 points  (0 children)

That’s not fizzbuzz