{"id":40,"date":"2026-02-28T09:55:01","date_gmt":"2026-02-28T04:55:01","guid":{"rendered":"https:\/\/gigz.pk\/python\/?post_type=lesson&#038;p=40"},"modified":"2026-03-12T09:59:07","modified_gmt":"2026-03-12T04:59:07","slug":"running-python-scripts","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/python\/lesson\/running-python-scripts\/","title":{"rendered":"Running Python Scripts"},"content":{"rendered":"\n<p>Running a Python script means executing a Python program so the computer can read the instructions and display the output. After installing Python and setting up your IDE, the next important step is learning how to properly run your Python files.<\/p>\n\n\n\n<p>A Python script is a file that contains Python code and is saved with the extension .py. For example, a file named program.py is a Python script.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>CREATING A PYTHON SCRIPT<\/strong><\/h1>\n\n\n\n<p>To create a Python script, follow these steps:<\/p>\n\n\n\n<p>Step 1<br>Open your IDE or code editor.<\/p>\n\n\n\n<p>Step 2<br>Click on New File.<\/p>\n\n\n\n<p>Step 3<br>Write your Python code. Example:<\/p>\n\n\n\n<p>print(&#8220;Hello World&#8221;)<\/p>\n\n\n\n<p>Step 4<br>Save the file with a .py extension such as hello.py.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>RUNNING PYTHON SCRIPTS USING COMMAND PROMPT<\/strong><\/h1>\n\n\n\n<p>You can run a Python script using Command Prompt in Windows or Terminal in Mac or Linux.<\/p>\n\n\n\n<p>Step 1<br>Open Command Prompt or Terminal.<\/p>\n\n\n\n<p>Step 2<br>Navigate to the folder where your Python file is saved using the cd command.<\/p>\n\n\n\n<p>Step 3<br>Type the following command:<\/p>\n\n\n\n<p>python filename.py<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>python hello.py<\/p>\n\n\n\n<p>If everything is correct, the output will be displayed on the screen.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>RUNNING PYTHON SCRIPTS USING AN IDE<\/strong><\/h1>\n\n\n\n<p>Most IDEs allow you to run scripts easily with a Run button.<\/p>\n\n\n\n<p>IDLE<br>Open the file, click Run, then select Run Module.<\/p>\n\n\n\n<p>Visual Studio Code<br>Open the file and click the Run button or press Ctrl + F5.<\/p>\n\n\n\n<p>PyCharm<br>Open the file and click the Run icon at the top.<\/p>\n\n\n\n<p>The output will appear in the terminal or output panel inside the IDE.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>COMMON ERRORS WHILE RUNNING SCRIPTS<\/strong><\/h1>\n\n\n\n<p>File Not Found Error<br>This happens when you are not in the correct folder while running the script.<\/p>\n\n\n\n<p>Python Not Recognized Error<br>This occurs if Python was not added to PATH during installation.<\/p>\n\n\n\n<p>Syntax Error<br>This occurs when there is a mistake in your code such as missing quotation marks or brackets.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>WHY RUNNING SCRIPTS IS IMPORTANT<\/strong><\/h1>\n\n\n\n<p>Running Python scripts allows you to test your code, identify errors, and see the results of your logic. It is a fundamental skill every Python learner must practice.<\/p>\n\n\n\n<p>Once you understand how to run Python scripts, you can confidently build programs and explore more advanced Python concepts.<\/p>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1773291596237\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/python\/\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">PYTHON FUNDAMENTALS (PYF) > Introduction to Python > Running Python Scripts<\/span><\/span><\/div>","protected":false},"menu_order":4,"template":"","class_list":["post-40","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Running Python Scripts - One Language. Endless Possibilities<\/title>\n<meta name=\"description\" content=\"Learn how to run Python scripts using IDEs or command prompt, test code, fix errors, and view output for beginner programming.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/python\/lesson\/running-python-scripts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Running Python Scripts - One Language. Endless Possibilities\" \/>\n<meta property=\"og:description\" content=\"Learn how to run Python scripts using IDEs or command prompt, test code, fix errors, and view output for beginner programming.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/python\/lesson\/running-python-scripts\/\" \/>\n<meta property=\"og:site_name\" content=\"One Language. Endless Possibilities\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-12T04:59:07+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/running-python-scripts\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/running-python-scripts\\\/\",\"name\":\"Running Python Scripts - One Language. Endless Possibilities\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/#website\"},\"datePublished\":\"2026-02-28T04:55:01+00:00\",\"dateModified\":\"2026-03-12T04:59:07+00:00\",\"description\":\"Learn how to run Python scripts using IDEs or command prompt, test code, fix errors, and view output for beginner programming.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/running-python-scripts\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/running-python-scripts\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/running-python-scripts\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/python\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PYTHON FUNDAMENTALS (PYF) > Introduction to Python > Running Python Scripts\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/python\\\/\",\"name\":\"One Language. Endless Possibilities\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/python\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Running Python Scripts - One Language. Endless Possibilities","description":"Learn how to run Python scripts using IDEs or command prompt, test code, fix errors, and view output for beginner programming.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gigz.pk\/python\/lesson\/running-python-scripts\/","og_locale":"en_US","og_type":"article","og_title":"Running Python Scripts - One Language. Endless Possibilities","og_description":"Learn how to run Python scripts using IDEs or command prompt, test code, fix errors, and view output for beginner programming.","og_url":"https:\/\/gigz.pk\/python\/lesson\/running-python-scripts\/","og_site_name":"One Language. Endless Possibilities","article_modified_time":"2026-03-12T04:59:07+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/python\/lesson\/running-python-scripts\/","url":"https:\/\/gigz.pk\/python\/lesson\/running-python-scripts\/","name":"Running Python Scripts - One Language. Endless Possibilities","isPartOf":{"@id":"https:\/\/gigz.pk\/python\/#website"},"datePublished":"2026-02-28T04:55:01+00:00","dateModified":"2026-03-12T04:59:07+00:00","description":"Learn how to run Python scripts using IDEs or command prompt, test code, fix errors, and view output for beginner programming.","breadcrumb":{"@id":"https:\/\/gigz.pk\/python\/lesson\/running-python-scripts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/python\/lesson\/running-python-scripts\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/python\/lesson\/running-python-scripts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/python\/"},{"@type":"ListItem","position":2,"name":"PYTHON FUNDAMENTALS (PYF) > Introduction to Python > Running Python Scripts"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/python\/#website","url":"https:\/\/gigz.pk\/python\/","name":"One Language. Endless Possibilities","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/python\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/lesson\/40","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/media?parent=40"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}