🐍 Your First Python Program: Beyond "Hello World"

I know what you're thinking: "Another 'Hello World' tutorial?" But this first program is more than just text on a screen. It's your declaration of independence, your first step towards a new professional identity. And as someone who's been in your shoes, I'll guide you through each step explaining the "what," "how," and "why."

Setting the Stage: Getting to Know PyCharm

A programmer needs their development environment, just as a social scientist needs their field notebook. PyCharm is your new digital workspace, and although it might seem overwhelming at first (trust me, I almost ran away the first time), it will soon become your best ally.

    • It's like your personal library or archive.

    • Here you organize all your code documents.

    • You can create folders by topic, just as you would organize your research materials.

    • Your new working document.

    • Here you write your code, like you used to write your essays or analyses.

    • With the advantage that it warns you when you make mistakes (like having a real-time proofreader!).

    • Like seeing your research results.

    • This is where your code's output appears.

    • It also shows you errors (we all make them at first; it's part of learning!)

    • Your basic toolkit.

    • From here you can run and debug your code.

    • Don't worry about memorizing everything now. You'll discover the tools when you need them.

Step by Step: Creating Your First Program

1. Organizing Your Workspace

a) Create a folder called 'python_exercises' (or a name you'll remember).

  • Organization is key.

  • use_lowercase_and_underscores (Python likes order as much as an academic).

  • Consider this folder as your new digital field notebook.

b) Open PyCharm and connect to your workspace:

  • Go to "File → Open".

  • Navigate to your 'python_exercises' folder.

  • This will be your workspace during your Python adventure.

2. Your First Python Document

Let's create your first code file, like when you wrote your first field journal entry:

a) Create a new file (⌘-N on Mac, Ctrl+N on Windows)

  • Name it 'my_first_program.py'.

  • The '.py' tells the computer "this is Python code".

  • Pro-tip: Use descriptive names. You labeled everything in fieldwork, right?

b) Write your first line of code:

print("Hello! I'm learning Python")

  • 'print()' is like writing in your notebook.

  • Quotation marks are important, just like in your transcriptions.

  • You can customize the message - it's YOUR program!

c) Time to "publish" your work

  • Press the green ▶️ button (or Ctrl+R).

  • Watch the console below (like reviewing your notes).

  • Congratulations! You made your first Python "publication".


3. Reflection Time

As good social researchers, let's take a moment to reflect:

  • What just happened? You gave the computer an instruction, and it responded.

  • Why is it important? This is your first dialogue with the machine.

  • What's next? Each new learning opens doors to more possibilities.


Behind the Scenes: Python as Your Personal Translator

Have you worked with a translator? Python is exactly that: a translator between you and the computer. Think of it this way:

You → Python → Computer

  • You write print("Hello!") (language you understand).

  • Python translates it to binary code (the computer's language).

  • The computer executes the instructions and displays "Hello!" on screen.

It's like working with texts in other languages:

  • You write in "human language".

  • Python acts as translator.

  • The computer receives the message in its "native language".

Why is this important?

  • You don't need to learn machine language.

  • Python translates for you.

  • Focus on expressing your ideas, not technical details.

It's like having a research collaborator who:

  • Understands your instructions in simple language.

  • Converts them into precise actions.

  • Returns results in a comprehensible way.

This is why Python is so popular among those coming from humanities and social sciences: it allows us to communicate with computers using language closer to how we naturally think.

Remember: All great programmers started exactly where you are now. The difference is they didn't give up.

 
Previous
Previous

🧵 First Steps with Text Strings in Python: [Part 2 of 3]: f-strings, Indexing, and Slicing

Next
Next

🪄 The Magic of Variables: Your First Step in Python Explained