Programming with Python
References
Arianne Dee
PyCharm Layout
Sections
FILE NAVIGATION
FILE CONTENTS
PYTHON CONSOLE
Toolbars
NAVIGATION
FILE TABS
LEFT TOOLBAR
CONSOLE/RUN TABS
BOTTOM TOOLBAR
2 of 7
Keyboard Shortcuts
References
https://www.jetbrains.com/help/pycharm/mastering-keyboard-shortcuts.html
Select operating system/key-map at top
https://resources.jetbrains.com/storage/products/pycharm/docs/PyCharm_ReferenceCard.pdf
Some differences between PC/Mac/PyCharm versions
Edit/browse shortcuts
Go to Settings > Keymap
Common shortcuts
A. PyCharm
Ctrl + Shift + A Search for keyboard shortcut
Ctrl+, Open settings
Alt+Enter Show error dialogue
B. Most programs
Ctrl+C Copy Ctrl+V Paste
Ctrl+Z Undo Ctrl+Shift+Z Redo
Ctrl+F Find in file Ctrl+R Replace in file
C. Navigation
Shift+Arrows Select multiple characters/lines Tab+Up Widen selection
D. New lines
Ctrl+Back Delete entire line
Shift+Enter Start new line below Ctrl+Enter Start new line above
E. Used in workshop
Ctrl+/ Comment / uncomment line
Ctrl+D Duplicate selection
Ctrl+Shift+↑ Move line up Ctrl+Shift+↓ Move line down
Ctrl+Alt+L Reformat file
Ctrl+B Go to definition
F. Advanced
Shift+F6 Rename F6 Move
Ctrl+Shift+F Find in project Ctrl+Shift+R Replace in project
Ctrl+Shift+] Go to next tab Ctrl+Shift+[ Go to previous tab
Ctrl+Shift+U Toggle case
3 of 7
Setting your Python version
1. Open settings/preferences
Mac PC
2. Navigate to Project Interpreter
3a. Select existing interpreter
4 of 7
3b. Add new interpreter
4. Add a system interpreter
5a. Select existing system interpreter
5 of 7
5b. Find system interpreter
If you’re not sure where to find it
Windows (look for python.exe)
• C:\Python38
• C:\Program Files\Python38
• C:\Users\username\AppData\Local\Programs\Python\Python38-XX
Mac (look for python3.8 or python3)
• /usr/local/bin/
• /Library/Frameworks/Python.framework/Versions/3.8/bin/
• /usr/local/Cellar/python/3.8.X_X/bin/
• /Users/username/anaconda/bin/
• /anaconda3/bin/
Linux (look for python3.8 or python3)
• /usr/bin/
• /usr/local/bin
6 of 7
Python 2 vs Python 3
If you haven’t been able to get Python 3 working, here are some of the differences that may
affect you throughout the workshop.
Getting user input
Python 3
name = input(“What’s your name?”)
Python 2
name = raw_input(“What’s your name?”)
String formatting
Python 3
print(f"hello {name}")
Python 2
print("hello {}".format(name))
Integer vs. float division
Python 3
1/2 => 0.5
1//2 => 0
Python 2
1/2 => 0
1./2 => 0.5
7 of 7