Writing a Python Program in PyCharm

Add a file to the project you created:

adding a new Python file to the project in PyCharm

Name your file:

shows naming a new file myprogram in PyCharm

A new file appears:

shows a new file in the PyCharm editor

Delete the text in the file, and replace it with:

def add():
    print(2+2)

add()

You should see:

shows the code pasted above in the editor

We'll go over the basics of Python in a bit. For now, let's run the code in a debug mode:

shows right-click context menu Debug option

A debug window should appear and run your program:

shows PyCharm debug part of the PyCharm editor

Next: Variables in Python

Comments

Leave a comment

What color are green eyes? (spam prevention)
Submit
Code under MIT License unless otherwise indicated.
© 2020, Downranked, LLC.