Performance issue when running python file

Hey everyone,

I'm experiencing a performance drop when running a Python file. I'm using VS Code on Windows 10 while learning to program.

When I hit the run button, the runtime of the program is 5.0 seconds, even though it should execute in roughly about 0.003 milliseconds.

I have tried switching to older versions like 2025.6.1, but that didn't work.

Any solutions to that problem?

reddit.com
u/Nutellatoast_2 — 14 days ago

Looking for improvements on my project "Rock-Paper-Scissors"

Hey everyone,

I'm new to Python and have created my "Rock-Paper-Scissors" game and want to share it on this forum so I can look for ways to improve the code.

The player types in a number between zero and two. These values stand for different moves the player can type. (0 - Rock, 1 - Paper, 2 - Scissors). The computer generates a number between zero and two. The player's input is checked by the main if-elif-else block, as I'm using a nested if-elif-else statement:

import random


player_input = int(input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissor. "))
computer = random.randint(0, 2)


if player_input == 0: 
    if computer == 0:
        print('''You chose: 
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)


Computer chose: 
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)
It's a draw!!!''')    
    elif computer == 1: 
        print('''You chose: 
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)    
Computer chose: 
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________)
You lost!!!''')
    elif computer == 2: 
        print('''You chose:
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)    
            
Computer chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
You won!!!''')
elif player_input == 1:
    if computer == 1: 
        print('''You chose:
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________)
Computer chose: 
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________)
It's a draw!!!''')
    elif computer == 0: 
        print('''You chose:
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________) 
Computer chose:  
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)
You won!!!''')
    elif computer == 2:
        print('''You chose:
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________) 
Computer chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
You lost!!!     
''')
elif player_input == 2:
    if computer == 2: 
        print('''You chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
Computer chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
It's a draw!!!''')
    elif computer == 1: 
        print('''You chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
Computer chose:
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________)             
You won!!!        ''')
    elif computer == 0:
        print('''You chose:
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
Computer chose:
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)    
You lost!!!        ''')

Any recommendations regarding improvements for the code?

reddit.com
u/Nutellatoast_2 — 1 month ago

Why isn't this code block working?

Hey everybody,

I'm new to programming with Python and following along with a Udemy Course. I'm now learning about lists and need to write a "Who will pay the bill"-like game.

It works like this: you have a pseudorandom number generator and a list of friends. Each time, the number generator generates a number between the given indices of the list. If the randomly generated number is equal to a specific index of that list, it should print out the person who must pay the bill by using an if-elif statement.

I've been using what I learned from the past lessons. This is what the code looks like (and yeah, I know, I messed up pretty badly, even though I have already found a solution):

import random

friends = ["Alice", "Bob", "Charlie", "David", "Emanuel"]

random_select = random.randint(0, 4)

if random_select == friends[0]:                  
    print("Alice has to pay the bill. ")
elif random_select == friends[1]:
    print("Bob has to pay the bill. ")
elif random_select == friends[2]:
    print("Charlie has to pay the bill. ")
elif random_select == friends[3]:
    print("David has to pay the bill. ")
elif random_select == friends[4]:
    print("Emanuel has to pay the bill. ")

But I couldn't really figure out why the code won't work.

reddit.com
u/Nutellatoast_2 — 1 month ago

What makes these driving games from 2013-2017 so good?

Hey everyone,

I would like to know what makes these games so good that one of them actually hit 500 million downloads on the Google Play Store. When people think, play or see these games, they often feel some sort of nostalgia for them. But why is that, and why were these games so famous back then?

Does anyone have an explanation?

https://preview.redd.it/gecmwvymjsch1.png?width=512&format=png&auto=webp&s=20221d4d56fb6d5c04764a92f48969a5a763e76c

https://preview.redd.it/lfetxs2ejsch1.png?width=512&format=png&auto=webp&s=34963dcadf36a9c0fe08b58c3dd23f14c6523908

https://preview.redd.it/h0sswyogjsch1.png?width=512&format=png&auto=webp&s=d0b89b56e5dc4b1d073c504590421111013e2112

https://preview.redd.it/8jmase0uisch1.png?width=447&format=png&auto=webp&s=c1c5acd728deb6fb5e53b0ab1eb94ed036af31a6

reddit.com
u/Nutellatoast_2 — 3 months ago
▲ 2 r/MaladaptiveDreaming+1 crossposts

How can I stop daydreaming and regain my focus?

Hey everyone,

I would like to share my story with y'all because I have no one to talk to. I don't have the confidence to tell my parents about it. I had 7-8 childhood friends back then in 2017, and we did have some fun together. We were out spending some time in the playground, and when 2020 and the pandemic came, we couldn't get out and do the same usual things, so we lost contact, but we were still friends.

It all began at the end of 2022, as I had started behaving weirdly. I think it was mainly because of my puberty back then. 2 of my childhood friends were sitting down on a staircase in front of the entrance door to the housing complex. They yelled my name, and I came to them and started acting and talking weirdly. Back then, I didn't think about my behaviour back then. But as I started to grow and became more conscious and mature, I thought more about it. And 2025 was when it all began; I started daydreaming about fake scenarios, imagining I wished I had never done this, or that I would never have acted weirdly when speaking to them. Now they keep avoiding me till now. And I never had the courage or confidence to talk to them and apologise for my behaviour back then. I was ashamed, in fact.

Now I keep dreaming about fake scenarios about never having done that. I also dream about being on a stage, presenting a game I coded entirely on my own, imagining myself as the main character, and my childhood friends who once avoided me and never wanted a chat eventually seeing me as a nice guy, or never associating me with my past.

But the real problem is that I have started going to a swing and keep daydreaming. I usually go for 30-60 minutes a day, with headphones in my ear, and listen to music while I'm swinging. It breaks my focus, and it's not only that. I face this daydream cycle when I'm doing productive work or going after the hobby that's bringing me closer to my future. I want to break this cycle and regain my focus. I don't want to live in my head anymore and actually focus on my hobbies and work again.

Does anyone have tips for me about how to regain my focus and stop living in my head?

reddit.com
u/Nutellatoast_2 — 3 months ago

Python code not running in VS Code

Hey everyone,

I have tried running python code in VS Code but it won't run:

https://preview.redd.it/ip5hjigk1kch1.png?width=1500&format=png&auto=webp&s=563553293b28ac3f73ab4142a926ba3dd7409737

If I press run it seems that it gives the folder path instead of the code. The Output sessions won't run it either:

https://preview.redd.it/m23wtd9r1kch1.png?width=1498&format=png&auto=webp&s=5ae3d2a5579ea31fc1292a83f3f0b29c37c5f933

Any solutions to that problem?

reddit.com
u/Nutellatoast_2 — 3 months ago

Python debugger recognizing file path but not running code issue

Hey everyone,

I'm currently learning Python programming with the "Crash Course Python" book from Eric Matthes.

I just want to run the file, but instead of getting the code, I'm getting a file path on the terminal in VS Code:

https://preview.redd.it/7pyc7xg4gdch1.png?width=1069&format=png&auto=webp&s=7389250be26c36cf066bdacf6a180f619e7641f7

Any solutions to that problem?

reddit.com
u/Nutellatoast_2 — 3 months ago
▲ 1 r/Ubuntu+1 crossposts

"fg: no current job" error after cloning git-repository

Hey everyone,

I want to give my Linux terminal a beautiful makeover. and I have followed along with this guide: https://www.youtube.com/watch?v=ffmm80_Cii4&t=176s .

I have ran into an error when I carried out this command:

% git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git .   

This is the error message I got:

fg: no current job

Any solutions to that problem?

u/Nutellatoast_2 — 3 months ago
▲ 3 r/Ubuntu+1 crossposts

How can I downgrade Grand Theft Auto IV on Ubuntu?

Hey there,

Just installed Grand Theft Auto IV. I'm a little bit to lazy to play the game trough, and want install some mods like the LCPD:FR mod for example. I have found a guide about modding GTA IV on Linux: www.youtube.com/watch?v=wRoJb3oq8zs . But I couldn't understand how he came into the files of the game, or the main files. The link he provided in the description about downgrading the game doesn't work either.

So how am I supposed to downgrade Grand Theft Auto IV? What should I do to downgrade the game?

u/Nutellatoast_2 — 3 months ago
▲ 1 r/Ubuntu

Amazon Basics Speakers not working on my computer

Hey everyone,

Just got the amazon basics stereo loudspeakers for my computer. But it seems that I don't get any audio output from the speakers. I have tried solving this by typing the command: alsamixer in the terminal and followed the instructions from a youtube tutorial. (I'm using Ubuntu btw)

But I still don't get any audio output.

https://preview.redd.it/v5fa5s8g17bh1.png?width=3024&format=png&auto=webp&s=5fd268ae12d78b94dd3d38654e24e72145559e99

Any solutions to that problem?

reddit.com
u/Nutellatoast_2 — 3 months ago

Amazon Basics Speakers not working on my computer

Hey everyone,

Just got the amazon basics stereo loudspeakers for my computer. But it seems that I don't get any audio output from the speakers. I have tried solving this by typing the command: alsamixer in the terminal and followed the instructions from a youtube tutorial.

But I still don't get any audio output.

https://preview.redd.it/jvjpij2217bh1.png?width=3024&format=png&auto=webp&s=87cea377c86ca116409346cb9cda02a3dc4a564f

Any solutions to that problem?

reddit.com
u/Nutellatoast_2 — 3 months ago

What to do, if I want to learn about Linux?

Hey there,

I have installed Linux like 3 months or so, and I'm satisfied with it. I have tried some things out, like customizing the terminal or downloading some themes especially icons and setting up VS code. But I want to know how Linux, the file system and the command line works.

I'm thinking of buying the book "The Linux Command Line" by William Shotts, and some other books.

But what learning source do you recommend?

reddit.com
u/Nutellatoast_2 — 3 months ago
▲ 2 r/Ubuntu

How can I reset my terminal configurations?

ey everyone,

I have installed some configuration mods for my terminal so it looks beautiful. But I have messed some things up, and now the terminal looks like this:

https://preview.redd.it/azf8s7wqjvah1.png?width=795&format=png&auto=webp&s=f5057b331067e2dfdf19cf1927e1b8fc51cdba12

And I want to reset my configurations for the terminal to look like this again:

https://preview.redd.it/mn7aunevjvah1.png?width=1231&format=png&auto=webp&s=68437d028f1000f163449e0e93eafbf88d1d57ae

So what is the solution to that?

reddit.com
u/Nutellatoast_2 — 3 months ago

Are there any "frutiger-aero"-like themes and icons which I can install on Ubuntu?

Hey there,

I've been using Ubuntu for like 2 months or so, and the only thing I cannot get along with is the theme and the icons.

I want a "Frutiger Aero"-like theme on my setup, but I couldn't find anything on the internet that pleases me.

What are your recommendations?

reddit.com
u/Nutellatoast_2 — 4 months ago

"Command not found"-Error when trying to download Vulkan Drivers

Hey everyone,

I just wanted to download the Vulkan Drivers, and encountered this error message by typing this command:

❯ sudo apt install

mesa-vulkan-drivers

vulkan-utils

Zusammenfassung:

Aktualisiere: 0, Installiere: 0, Entferne: 0, Aktualisiere nicht: 0

mesa-vulkan-drivers: Befehl nicht gefunden.

vulkan-utils: Befehl nicht gefunden.

Any solution to that problem? And btw, I'm using Ubuntu Linux.

reddit.com
u/Nutellatoast_2 — 4 months ago

How do the .removeprefix() and .removesuffix() methods work?

Hey there,

I'm new to Python, and I wanted to know if somebody could explain why and how the .removeprefix() and .removesuffix() work? I can't get my head over it. For example:

filename = "test"
file_ending = ".py"
file = f"{filename}{file_ending}"          

I created three variables, and let's say, I want to remove the suffix with the .removesuffix() method:

print(file.removesuffix(file_ending))

What I'm getting at is that I also could write this instead:

print(file.removesuffix(filename))

Usually, you would write removeprefix instead of removesuffix. This is just an example.

But why won't the removesuffix() method delete the filename? Or better, how does the computer know which part of the string a prefix or suffix is?

reddit.com
u/Nutellatoast_2 — 4 months ago

Cannot run my python file using the terminal on Ubuntu

Hey there,

I have a problem running my Python file using the directory commands in my terminal. So if I wanted to run hello_world.py, I should usually, as the book I'm learning with suggests, type the path to my folder in my terminal. Something like this: cd /home/abdu/hello_world.py. This is the directory my folder is in. Am I missing something?

And what are better approaches to open and execute Python directly from the terminal?

reddit.com
u/Nutellatoast_2 — 4 months ago