0

Visual studio code running python3 scripts

Sorry, guys, it's me again, I'm practicing the FIZZBUZZ code in Visual Studio Code, I use something like: for i in range(n) if n % 5 == 0 and n % 3 == 0: print("FizzBuzz!") elif n % 5 == 0: print("Fizz") elif n % 3 == 0: print("Buzz") else: print(n) So, when I run (with F5) the script, Visual Studio Code runs the script like several time and not only once as I want(and I think as a beginner that I am that should be), is there a way to fix that on the Visual Studio Code settings for debugging or something, it's frustrating for me. Sorry if this question is out of scope in SoloLearn, but I've tried to find the solution online and in the Visual Studio Code website, maybe I'm not browsing properly the inquiry but I haven't found a solid answer or even something similar to my question. Thanks in advance! Enjoy your weekend, life is short and good!

25th Jul 2020, 3:36 AM
Whally O.
Whally O. - avatar
5 ответов
+ 2
have you run the code from the terminal?
25th Jul 2020, 3:55 AM
Logomonic Learning
Logomonic Learning - avatar
+ 1
try it in pycharm Whally O
25th Jul 2020, 8:48 AM
Mr. 12
Mr. 12 - avatar
+ 1
Try running it directly in the terminal. Sometimes you have to specify the python version you are using. E.g python3 myscript.py. Alternatively, find a python online interpreter, e.g repl.it and test the code there
25th Jul 2020, 10:42 AM
Logomonic Learning
Logomonic Learning - avatar
0
Logomonic Learning Yes! Its running in the lower part in Powershell(VisualStudioCode terminal) I mean is running, but I don't know why it runs like 3 or 4 times, when I saw on tutorials on YouTube that it only run once.
25th Jul 2020, 4:08 AM
Whally O.
Whally O. - avatar
0
Mr. 12 Thank you, so, not clear reason why is doing that?
25th Jul 2020, 9:58 AM
Whally O.
Whally O. - avatar