Python for Beginners · Lesson 1 of 8
Running your first line of Python
Run real Python code and see it work, within five minutes, with nothing installed.
That was a one-minute preview. The full course video is for signed-in learners. Sign in to watch it here, or create a free BvLogic ID.
Most people who try to learn programming quit before they write a single line — not because coding is hard, but because *installing* things is hard. So we are skipping that entirely.
Open your browser and go to any free online Python editor (we recommend the one linked in your BvLogic dashboard). You will see a box to type in and a Run button. That is all you need for this whole course, and it works on a phone.
Type exactly this:
print("Hello, Pakistan")
Press Run. Below, you will see:
Hello, Pakistan
That is a program. A real one. Let us look at what you just did.
print is an instruction — it tells Python to display something. The round brackets hold what you want displayed. The quote marks tell Python "this is text, not an instruction".
Try removing the quote marks and running it again. You will get an error. Do it — seeing the error now, on purpose, makes it far less frightening when it happens by accident later.
Now try:
print("My name is Ayesha")
print("I am learning Python")
Two lines, run top to bottom, in order. That is the second thing to understand about programming: Python does exactly what you say, in the order you say it. It never guesses what you meant.
That is the whole idea. Everything else in this course is just more interesting instructions.
زیادہ تر لوگ جو پروگرامنگ سیکھنے کی کوشش کرتے ہیں ایک سطر لکھنے سے پہلے ہی چھوڑ دیتے ہیں، اس لیے نہیں کہ کوڈنگ مشکل ہے، بلکہ اس لیے کہ *انسٹال* کرنا مشکل ہے۔ تو ہم اسے مکمل طور پر چھوڑ رہے ہیں۔
اپنا براؤزر کھولیں اور کسی بھی مفت آن لائن Python ایڈیٹر پر جائیں (ہم آپ کے BvLogic ڈیش بورڈ میں دیے گئے ایڈیٹر کا مشورہ دیتے ہیں)۔ آپ کو لکھنے کا ایک خانہ اور Run کا بٹن نظر آئے گا۔ اس پورے کورس کے لیے بس یہی چاہیے، اور یہ فون پر بھی چلتا ہے۔
بالکل یہ لکھیں:
print("Hello, Pakistan")
Run دبائیں۔ نیچے آپ کو نظر آئے گا:
Hello, Pakistan
یہ ایک پروگرام ہے۔ اصلی پروگرام۔ آئیے دیکھتے ہیں آپ نے ابھی کیا کیا۔
print ایک ہدایت ہے، یہ Python کو کچھ دکھانے کو کہتی ہے۔ گول قوسین میں وہ ہوتا ہے جو آپ دکھانا چاہتے ہیں۔ واوین Python کو بتاتے ہیں کہ "یہ متن ہے، ہدایت نہیں"۔
واوین ہٹا کر دوبارہ چلا کر دیکھیں۔ آپ کو ایک غلطی ملے گی۔ ضرور کریں؛ غلطی کو ابھی، جان بوجھ کر دیکھ لینا اسے بعد میں اتفاقاً ملنے پر بہت کم ڈراؤنا بنا دیتا ہے۔
اب یہ آزمائیں:
print("My name is Ayesha")
print("I am learning Python")
دو سطریں، اوپر سے نیچے، ترتیب سے چلتی ہیں۔ پروگرامنگ کے بارے میں سمجھنے والی دوسری بات یہی ہے: Python بالکل وہی کرتا ہے جو آپ کہتے ہیں، اسی ترتیب میں جس میں آپ کہتے ہیں۔ یہ کبھی اندازہ نہیں لگاتا کہ آپ کا مطلب کیا تھا۔
بس یہی پورا خیال ہے۔ اس کورس میں باقی سب کچھ صرف زیادہ دلچسپ ہدایات ہیں۔
Write three print lines: your name, your city, and one thing you want to build. Run it. Then deliberately break one line (remove a bracket) and read the error before fixing it.
تین print lines لکھیں: آپ کا نام، آپ کا شہر، اور ایک چیز جو آپ بنانا چاہتے ہیں۔ چلائیں۔ پھر جان بوجھ کر ایک line توڑیں (ایک bracket ہٹائیں) اور ٹھیک کرنے سے پہلے error پڑھیں۔
Check what you learned
Create your free BvLogic ID to take the quiz and record your score.
Create your BvLogic IDUp next: 2. Variables and the types that trip people up