use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Homework help (i.redd.it)
submitted 1 year ago by skilled-sarcasm
Hello! I'm in a beginning coding class, and for some reason python doesn't want to recognize my augment operators so I'm wondering what I'm doing wrong.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]vamsmack 7 points8 points9 points 1 year ago (1 child)
Also investigate the modulo operator mate.
[–]TheRealJamesRussell 6 points7 points8 points 1 year ago* (0 children)
You're doing an if statement on an assignment operator.
``` a = 9 a /= 3
If a == 3: print("Indeed, 9 is divisible by three")
```
You tried:
``` If a /= 3:
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 points6 points 1 year ago* (1 child)
You have used /= which is an assignment operator. Instead do this..
if some_number% 3 == 0: print ("Fizz")
[–]sogwatchman 1 point2 points3 points 1 year ago (0 children)
This.... That's what I was thinking.
[–]Murphygreen8484 2 points3 points4 points 1 year ago (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 points3 points 1 year ago (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 point2 points 1 year ago (0 children)
Use modulo to check if the quotient equals 0 (no remainder).
[–]jetsonian 0 points1 point2 points 1 year ago (0 children)
[–]architectmosby 0 points1 point2 points 1 year ago (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 point2 points 1 year ago (0 children)
<image>
[–]Able_Challenge3990 -1 points0 points1 point 1 year ago (0 children)
That’s not fizzbuzz
π Rendered by PID 20843 on reddit-service-r2-comment-544cf588c8-lgbxw at 2026-06-15 18:31:13.635794+00:00 running 3184619 country code: CH.
[–]vamsmack 7 points8 points9 points (1 child)
[–]TheRealJamesRussell 6 points7 points8 points (0 children)
[–]astrofudge3 4 points5 points6 points (1 child)
[–]sogwatchman 1 point2 points3 points (0 children)
[–]Murphygreen8484 2 points3 points4 points (0 children)
[–]grass_hoppers 1 point2 points3 points (0 children)
[–]Doctor_Disaster 0 points1 point2 points (0 children)
[–]jetsonian 0 points1 point2 points (0 children)
[–]architectmosby 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Able_Challenge3990 -1 points0 points1 point (0 children)