Anna
Anna

Reputation: 1

How to see output in VS Code?

I'm new to VS Code. I run simple function in Python and want to see output. I use "Debug" -> "Start Debugging".

def double_char_function(string):
string = 'abc'
return_string = ''

for char in string:
    return_string += char*2
return return_string

I want to see the output:

aabbcc

I saw it when I run it. But don't know how to see it again. Please, help me to use VS Code.

Screenshots:

  1. Terminal output
  2. Output is empty

Kind regards, Anna

Upvotes: 0

Views: 665

Answers (3)

Mohammadali Davarzani
Mohammadali Davarzani

Reputation: 29

Try:

def double_char_function(string):
    return_string = ''

    for char in string:
       return_string += char*2
    
    return return_string
string = "Hello!"
print(double_char_function(string))

Upvotes: 0

Forrest Wei
Forrest Wei

Reputation: 1

Apart from the solutions provided above, I'd recommend you to learn the basics from a YouTube tutorial (eg. tutorials by CoreyMS, Mosh, etc), since it's always better to learn systematically especially for a beginner.

Upvotes: 0

Try:

def double_char_function(string):
    return_string = ''

    for char in string:
        return_string += char*2
    return return_string

print(double_char_function('abc'))

Upvotes: 1

Related Questions