PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, December 11, 2022

[FIXED] What does the /= operator mean in Python?

 December 11, 2022     python, syntax     No comments   

Issue

What does the operator /= (slash equals) mean in Python?

I know |= is a set operator. I have not seen /= previously though.


Solution

It's an assignment operator shorthand for / and =.

Example:

x = 12
x /= 3
# equivalent to
x = x / 3

If you use help('/='), you can get the full amount of symbols supported by this style of syntax (including but not limited to +=, -=, and *=), which I would strongly encourage.



Answered By - Makoto
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing