Course එකට ආපසු

ඔබේ පළමු AI Code එක

30 මිනිත්තු🏋️Activity

🎯 පාඩමේ අරමුණු

මේ පාඩම ඉවර වෙද්දී ඔයාට:

  • AI ලියපු ඔයාගේ පළවෙනි code piece එක generate කරන්න පුළුවන් වෙයි
  • Fully understand නොකර code READ කරන්න ඉගෙන ගන්න පුළුවන් වෙයි
  • Basic code elements (variables, functions, print statements) identify කරන්න පුළුවන් වෙයි
  • AI ට code explain කරන්න ask කිරීම practice කරන්න පුළුවන් වෙයි

📖 Introduction: Running කරන්න කලින් Reading

Vibe coding වලට important principle එකක් මෙන්න:

Reading Principle එක

Code එක්ක effectively WORK කරන්න කලින් Code READ කරන්න ඕන.

Syntax මතක තියාගන්න හෝ scratch එකෙන් code ලියන්න ඕන නැහැ. නමුත් ඔයා MUST:

  • Different parts මොකද කරන්නේ recognize කරන්න
  • Potential problems spot කරන්න
  • Logic flow තේරුම් ගන්න

ඒක music producer කෙනෙක් වෙනවා වගේ — every instrument play කරන්න ඕන නැහැ, but something sounds wrong නම් hear කරන්න ඕන.


🎮 Workshop Task එක

Simple program එකක් create කරමු:

Goal: Birth year අහලා age කියන Python script එකක්.

ඇයි Python?

  • Clean, readable syntax
  • Code READ කරන්න ඉගෙන ගන්න perfect
  • Most common languages වලින් එකක්

ඇයි මේ Task?

  • Understand කරන්න enough simple
  • Real coding concepts පෙන්වන්න enough complex
  • Clear input → process → output තියෙනවා

📝 Step 1: ඔයාගේම Prompt එක මුලින් ලියන්න

Examples බලන්න කලින්, මේ task එකට ඔයාගේම prompt ලියන්න try කරන්න.

Task එක: AI ට Python script එකක් create කරන්න කියන්න:

  1. User ගේ birth year අහනවා
  2. Age calculate කරනවා
  3. Age එක්ක friendly message පෙන්වනවා
📝

Reflection Journal

Saved privately on your device
0 characters
0 total characters

ඉදිරියට යන්න කලින් මේක ලියන්න minute එකක් ගන්න!


📝 Step 2: Example Prompt එක්ක Compare කරන්න

C.I.C. + Role use කරලා well-crafted prompt එකක් මෙන්න:

Example Prompt (C.I.C. + Role)
You are a Python developer teaching beginners. Write a simple Python script that: 1. Asks the user for their birth year 2. Calculates their age (assume it's currently 2024) 3. Prints a friendly message with their age Include comments explaining each line so a beginner can understand.
ChatGPTClaude

ඔයාගේ prompt එක්ක compare කරන්න:

  • Python specify කළාද?
  • Friendly message ask කළාද?
  • Comments/explanations request කළාද?

🤖 Step 3: Generated Code එක

Prompt එක send කළාම මේ වගේ එකක් ලැබෙන්න ඕන:

Python
# Age Calculator Program
# Get the current year
current_year = 2024
# Ask the user for their birth year
birth_year_text = input("What year were you born? ")
# Convert the text input to a number
birth_year = int(birth_year_text)
# Calculate the age
age = current_year - birth_year
# Display a friendly message
print(f"Awesome! You are {age} years old this year! 🎂")

Note: ඔයාගේ AI output එක slightly different විය හැකි — ඒක okay!


🔍 Step 4: Code Reading Scavenger Hunt

දැන් මේ code READ කරන්න ඉගෙන ගමු. Generated code එක බලලා මේ questions වලට answer කරන්න:

Question 1: Variables හොයන්න 🔎

Variables යනු information store කරන labeled boxes. = sign use කරලා create කරනවා.

Variables කීයක් spot කරන්න පුළුවන්ද?


Question 2: Math එක හොයන්න ➕➖

Age determine කරන calculation එක හොයන්න.

Subtraction වලට use කරන symbol එක මොකක්ද?


Question 3: Output එක හොයන්න 📤

print() function user ට text display කරනවා.

User දකින message එක මොකක්ද?


Question 4: Input එක හොයන්න 📥

input() function user ට type කරන්න ask කරනවා.

Program එක ask කරන question එක මොකක්ද?


Question 5: Conversion එක හොයන්න 🔄

Birth year වලට variables දෙකක් තියෙන එක notice කරන්න. ඇයි?


📊 Code Reading Quick Reference

Code කියවනකොට බලන්න ඕන දේවල් මෙන්න:

PatternUsually Mean කරන්නේ
something = valueData create/store කිරීම (variable)
function()Action එකක් කිරීම
# textComment එකක් (computer ignore කරනවා, humans ට help කරනවා)
"text" හෝ 'text'Text piece එකක් (string)
+, -, *, /Math operations
print()User ට මොකක් හරි display කිරීම
input()User ට type කරන්න ask කිරීම
if, elseDecisions ගැනීම
for, whileමොකක් හරි repeat කිරීම

🎓 Step 5: AI ට Explain කරන්න Ask කරන්න

දැන් AI ගෙන් explanations ගන්න practice කරන්න. මේ follow-up prompts try කරන්න:

Line-by-Line Explanation වලට:

Line-by-Line Explanation Request කරන්න
Explain this code line by line like I've never programmed before: [paste the code here]
ChatGPTClaude

Specific Part වලට:

Specific Line ගැන Ask කරන්න
What does this line do? birth_year = int(birth_year_text)
ChatGPTClaude

Concepts වලට:

Simple Explanation Ask කරන්න
What is a variable in programming? Explain like I'm 10 years old.
ChatGPTClaude

🧪 Step 6: Prompts හරහා Modify කරන්න

දැන් AI එක්ක conversation හරහා code modify කිරීම practice කරන්න.

Modification 1: Message එක Change කරන්න

Modification: Message Change කරන්න
Change the message to say 'Happy Birthday! You're {age} years young!'
ChatGPTClaude

Modification 2: Info වැඩි කරන්න

Modification: Feature Add කරන්න
Also calculate and display what year the person will turn 100
ChatGPTClaude

Modification 3: Validation Add කරන්න

Modification: Validation Add කරන්න
Add a check: if someone enters a year after 2024, tell them 'You haven't been born yet!'
ChatGPTClaude

මේවා එකින් එක try කරන්න. ඔයාගේ requests අනුව AI code modify කරන හැටි බලන්න!


🔑 Key Code Vocabulary

මේ lesson එකට පස්සේ, ඔයා recognize කරන්න ඕන:

Termඒක මොකක්දExample
VariableData වලට named storageage = 25
StringText data"Hello World"
IntegerWhole number2024
Functionමොකක් හරි කරන actionprint(), input()
CommentHumans වලට note# This is a comment
AssignmentVariable එකේ value store කිරීමx = 5

✅ Completion Checklist

ඉදිරියට යන්න කලින් verify කරන්න:

0/6

✅ පාඩමේ සාරාංශය

ඔයා Accomplish කළ දේ

  1. ✅ Code generation වලට ඔයාගේ පළවෙනි prompt ලිව්වා
  2. ✅ Working Python script එකක් AI ලවා create කරවගත්තා
  3. ✅ Parts තේරුම් ගන්න code analyze කළා
  4. ✅ AI ගෙන් explanations ask කිරීම practice කළා
  5. ✅ Follow-up prompts හරහා code modify කළා

Key Insight

Syntax මතක තියාගන්න ඕන නැහැ. Patterns recognize කර AI එක්ක clearly communicate කරන්න ඕන.


📝 Mini Quiz

📝 ඔයාගේ Understanding Check කරන්න

1/3

What does a variable do in programming?