1 | initial version |

Test test test

2 | No.2 Revision |

~~Test test test~~If I guessed the meaning of your "n.set_bit(7)" correctly, then it can be achieved via Python's bitwise operator `|`

as

3 | No.3 Revision |

If I guessed the meaning of your "n.set_bit(7)" correctly, then it can be achieved via Python's bitwise operator `|`

as

```
n |= 1<<7
```

4 | No.4 Revision |

If I guessed the meaning of your "n.set_bit(7)" correctly, then it can be achieved via Python's bitwise operator `|`

as

```
n |= 1<<7
```

You can find more details on bitwise operators at

To make `~`

work as in Python, convert the argument to `int`

first:

```
mask = ~int(1 << n)
```

See also this Q&A: https://ask.sagemath.org/question/23823/

5 | No.5 Revision |

If I guessed the meaning of your "n.set_bit(7)" correctly, then it can be achieved via Python's bitwise operator `|`

as

```
n |= 1<<7
```

You can find more details on bitwise operators at https://realpython.com/python-bitwise-operators/

To make `~`

work as in Python, convert the argument to `int`

first:

```
mask = ~int(1 << n)
```

See also this Q&A: https://ask.sagemath.org/question/23823/

6 | No.6 Revision |

`|`

as

```
n |= 1<<7
```

You can find more details on bitwise operators at https://realpython.com/python-bitwise-operators/

To make `~`

work as in Python, convert the argument to `int`

first:

```
mask = ~int(1 << n)
```

or as suggested in the comments:

```
mask = ~(int(1) << n)
```

or simply

```
mask = ~(1r << n)
```

See also this Q&A: https://ask.sagemath.org/question/23823/

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.