The deadlier virus

(So, I'm writing this as Storm Eunice rages outside, and being constantly frustrated by the whistling its making, so that's why myself will be very angry through the duration of this post. Also, this is adapted from CGP Greys video This video will make you angry.)

So, we all know about viruses, with most of us going through repeated lockdowns throughout these past few years due to Covid-19, but little did we all know that the most deadly virus being spread was through the Internet. See, if you are on Twitter and post a funny cat video, and say get 1000 views, then 10% of those people find it funny enough to share it to their friends. Some of these people will share it to groups or repost, so the funny cat video grows. Now, some of these people who know how to photoshop will change the cat video and make it funnier. This is like a mutation of the virus that makes it spread faster. The video will grow and grow until perhaps either a super-spreader (or extremely famous person on Twitter) will post it and it will explode onto other platforms. Or it just fizzles out and dies. But it has to die. Its just funny cat video, after all, and there are thousands of them uploaded every day, so all that will happen is another one will go through the same process, kicking you off your podium. When it has all ended though, you will have had thousands of people follow you, so your next funny cat video will have a far larger platform to kick of from. In this virus analogy, memes are like the common cold, ripping through quickly, barely killing anyone, and leaving, although some extremely popular ones stay around. Now take a hate Tweet, posted by non-other than our favourite racist orange, Donald Trump. He has a massive platform, so when he says something particularly racist, by which I mean more than the usual daily stream of bullshit coming out of every orifice then being viewed by millions, it blows up. First its shared on Twitter, then covered by more liberal news outlets and noted down as another hate crime by activists, then covered by conservative "news" stations such as Fox. This could mean wide spread violence and discrimination against whatever group he's targeted. As it grows, unbiased news like BBC reports about. After that, Joe Rogan, Tucker Carlson .etc jump on board. What either happens is it again fizzles out by people debunking everything in the Tweet as wrong (in this analogy chemotherapy) or it keeps growing, either seeping into culture, perhaps even recruiting people to vote for their conservative party in the next election, or even worse becoming something like the Capitol Hill riots in 2021, and the only people who want that is the powerful conservatives, don't they?

How To Make A Slot Machine Game In Python

So, I am currently working on a project called Henry's Palace (after Caesars Palace in Las Vegas) on Python. What was a simple dice game to teach m how to code probability has ballooned into 800 lines of code. recently, I added a huge extension, the slot machine. As I had trouble doing this I will show you my personal code for copy and pasting. You'll have to add spaces yourself. 

sym1 = random.choice(symbols)
sym2 = random.choice(symbols)
sym3 = random.choice(symbols)
print(sym1, sym2, sym3, "\n")
if (sym1 == sym2 or sym1 == sym3 or sym2 == sym3) and not(sym1 == sym2 == sym3):
print("Winner! +5p")
credit += 45
return credit

elif (sym1 == sym2 == sym3) and sym1 != "Bell":
print("Winner! +£50")
credit = credit + 50
return credit

elif (sym1 == sym2 == sym3) and (sym1 == "Bell"):
print("Jackpot! +£15")
credit = credit + 50
return credit

elif (sym1 == sym2 == "Skull" or sym1 == sym3 == "Skull" or sym2 == sym3 == "Skull") and not(sym1 == sym2 == sym3):
print("Two Skulls! -£75")
credit = credit - 100
return credit

elif (sym1 == sym2 == sym3) and sym1 == "Skull":
print("Three Skulls! Lose all credit")
credit = 0
return credit

print("Loser! -£20")
credit = - 20
return credit

symbols = ["Cherry", "Bell", "Lemon", "Orange", "Star", "Skull"]
print("You have", credit, "p", "\n")

#moneydrinker function
def moneydrinker(credit):
while True:
play = input("Roll costs 10p. Would you like to roll? yes/no: ")
if play == "yes" or "y" or "Yes" or "Y":
if credit >= 20:
credit -= 10
print("Credit is", credit, "p")
if credit < 20:
print ("You need more points! Time to go home,right?")
print("You do not enough money to roll!")
if intro==1:

Why is this code faster with Python than with C++?


I wrote a simple code to compare the speed of Python vs. C++. Here is the Python code:

def count_permutations(N:int)->int:
    for p in itertools.permutations(range(1,N+1)):
        count += 1
    return count

And here is the C++ code:

int count_permutations(int N) {
    vector<int> v(N);
    iota(v.begin(), v.end(), 1); // fill the vector with 1,...,N
    int count=0;
    do {
    } while ( next_permutation(v.begin(),v.end()) );
    return count;

When I run with Python 3.8.5 on Ubuntu, I get:

Permutations of 1..11:
  39916800 permutations calculated in 3.31172251701355 seconds
Permutations of 1..12:
  479001600 permutations calculated in 40.63520336151123 seconds

When I run with C++ (clang++-9) on the same Ubuntu, I get:

Permutations of 1..11:
  39916800 permutations calculated in 5 seconds
Permutations of 1..12:
  479001600 permutations calculated in 57 seconds

I find this very strange, since in the benchmarks website, C++ is always faster than Python.

Is it possible that recent versions of Python have become so fast that they are now faster than their C++ parallel?