Question: What is the meaning/purpose of using over and rank keywords in hive sql?

```
select rank() over (order by net_worth desc) as rank, name, net_worth from wealth order by rank, name;
+------+---------+---------------+
| rank | name    | net_worth     |
+------+---------+---------------+
| 1    | Solomon | 2000000000.00 |
| 2    | Croesus | 1000000000.00 |
| 2    | Midas   | 1000000000.00 |
| 4    | Crassus | 500000000.00  |
| 5    | Scrooge | 80000000.00   |
+------+---------+---------------+

```

Answer: 
You're missing a `not` in your application of De Morgan's Law:

```
total = 0

for x in range(1000):
    if not (x % 5 != 0 and x % 3 != 0):
        total += x
print(total)

```

`not (x % 5 != 0 and x % 3 != 0)` is equivalent to `x % 5 == 0 or x % 3 == 0`, the latter of which is stated in the page you link as the equivalent `not x%5 or not x%3`.
You are using the wrong condition. You have to test, when the rest is 0? With 3 and with 5. Additionally you have to use OR instead AND because you want both group of numbers.

If you use AND you are going to get only the numbers that are multiple of both, multiple of 3 and multiple of 5.

Try:

```
total = 0

for x in range(1000):
    if x % 5 == 0 or x % 3 == 0:
        total += x
print(total)

```