Search Bar

Thursday 16 March 2023

Python Programming Tut#03|First Program|Hello, World

Python Tutorial 03

Once you have learned the basics of Python, you can start writing your first Python program. A simple "Hello, World!" program is a good place to start. Open up your text editor or IDE and create a new Python file. Type the following code:

print("Hello, World!")

Save the file with a .py extension, such as hello.py then run the program. This program simply prints the text "Hello, world!" to the console.

The first line of the program is print("Hello, World!"). This line is a function call that tells Python to print the text "Hello, world!" to the console.

Python Programming Tutorial 03|First Program|Hello, World
Python Programming Tutorial 03|First Program| Hello, World

When you run the program, Python executes each line of code from top to bottom.

The print() function is a built-in function in Python that allows you to print text to the console.

The text to be printed is enclosed in quotation marks, which tells Python to treat it as a string of characters.

The text "Hello, world!" is enclosed in double quotes, but you could also enclose it in single quotes: print('Hello, world!'). In Python, either double or single quotes can be used to define a string.

Finally, the exclamation mark at the end of the string is simply a character that gets printed along with the rest of the text. It has no special meaning in Python.

Python Programming Tutorial 03|First Program|Hello, World
Python Programming Tutorial 03|First Program| Hello, World

ایک بار جب آپ نے Python کی بنیادی باتیں سیکھ لیں، آپ اپنا پہلا Python پروگرام لکھنا شروع کر سکتے ہیں۔ ایک سادہ "Hello, World!" پروگرام شروع کرنے کے لیے ایک اچھی جگہ ہے۔ اپنا ٹیکسٹ ایڈیٹر یا IDE کھولیں اور ایک نئی Python فائل بنائیں۔ درج ذیل کوڈ ٹائپ کریں۔

print ("Hello, World!")

 فائل کو .py ایکسٹینشن کے ساتھ محفوظ کریں، جیسے hello.py پھر پروگرام چلائیں۔ یہ پروگرام صرف متن پرنٹ کرتا ہے !Hello, World کنسول پر پروگرام کی پہلی لائن پرنٹ ہے  ("Hello, World!")۔ یہ لائن ایک فنکشن کال ہے جو متن پرنٹ کرنے کو کہتی ہے "Hello, World!" کنسول پر جب آپ پروگرام چلاتے ہیں، Python کوڈ کی ہر لائن کو اوپر سے نیچے تک چلاتا ہے۔ پرنٹ () فنکشن Python میں ایک بلٹ ان فنکشن ہے جو آپ کو کنسول میں ٹیکسٹ پرنٹ کرنے کی اجازت دیتا ہے۔ پرنٹ کیا جانے والا متن کوٹیشن مارکس میں بند کیا جاتا ہے، جو کہتا ہے کہ وہ اسے حروف کی ایک تار کی طرح سمجھے۔ متن "Hello، World!" ڈبل کوٹس میں بند ہے، لیکن آپ اسے سنگل اقتباسات میں بھی بند کر سکتے ہیں: print('Hello, world!')۔ Python میں، سٹرنگ کی وضاحت کے لیے یا تو ڈبل یا سنگل کوٹس استعمال کیے جا سکتے ہیں۔ آخر میں، سٹرنگ کے آخر میں فجائیہ نشان صرف ایک حرف ہے جو باقی متن کے ساتھ پرنٹ ہو جاتا ہے۔ Python میں اس کا کوئی خاص معنی نہیں ہے۔


1 comment:

  1. Good blog, I hope it will be helpful for those who want to learn world famous programming language.

    ReplyDelete