How to Run a Python Script-Task inplant and internship training in Python

How to Run a Python Script

Python is a well known high-level programming language. The Python script is basically a file containing code written in Python. The file containing python script has the extension ‘.py’ or can also have the extension ‘.pyw’ if it is being run on a windows machine. To run a python script, we need a python interpreter that needs to be downloaded and installed.

Here is a simple python script to print ‘Hello World!’:

print('Hello World!')

Here, the ‘print()’ function is to print out any text written within the parenthesis. We can write the text that we want to be printed using either a single quote as shown in the above script or a double quote.

If you are coming from any other language then you will also notice that there is no semicolon at the end of the statement as with Python, you no need to specify the end of the line. And also we don’t need to include or import any files to run a simple python script.

There is more than one way to run a python script but before going toward the different ways to run a python script, we first have to check whether a python interpreter is installed on the system or not. So in windows, open ‘cmd’ (Command Prompt) and type the following command.



python -V

This command will give the version number of the Python interpreter installed or will display an error if otherwise.

Different ways to run Python Script

Here are the ways with which we can run a Python script.

  1. Interactive Mode
  2. Command Line
  3. Text Editor (VS Code)
  4. IDE (PyCharm)
  1. Interactive Mode:
    In Interactive Mode, you can run your script line by line in a sequence.

    To enter in an interactive mode, you will have to open Command Prompt on your windows machine and type ‘python’ and press Enter.

    Example 1:
    Run the following line in the interactive mode:

    print('Hello World !')

    Output:

    Example 2:
    Run the following lines one by one in the interactive mode:

    name = "Aakash"
    print("My name is " + name)

    Output:

    Example 3:
    Run the following line one by one in the interactive mode:

    a = 1
    b = 3
    if a > b:
        print("a is Greater"
    else:
        print("b is Greater")

    Output:

    Note: To exit from this mode, press ‘Ctrl+Z’ and then press ‘Enter’ or type ‘exit()’ and then press Enter.

  2. Command Line
    To run a Python script store in a ‘.py’ file in command line, we have to write ‘python’ keyword before the file name in the command prompt.
    python hello.py
    

    You can write your own file name in place of ‘hello.py’.

    Output:

  3. Text Editor (VS Code)
    To run Python script on a text editor like VS Code (Visual Studio Code) then you will have to do the following:
    • Go in the extension section or press ‘Ctrl+Shift+X’ on windows, then search and install the extension named ‘Python’ and ‘Code Runner’. Restart your vs code after that.
    • Now, create a new file with the name ‘hello.py’ and write the below code in it:
      print('Hello World!')
      
    • Then, right click anywhere in the text area and select the option that says ‘Run Code’ or press ‘Ctrl+Alt+N’ to run the code.

    Output:

  4. IDE (PyCharm)
    To run Python script on a IDE (Integrated Development Environment) like PyCharm, you will have to do the following:
    • Create a new project.
    • Give a name to that project as ‘GfG’ and click on Create.
    • Select the root directory with the project name we specified in the last step. Right click on it, go in New and click on ‘Python file’ option. Then give the name of the file as ‘hello’ (you can specify any name as per your project requirement). This will create a ‘hello.py’ file in the project root directory.
      Note: You don’t have to specify the extension as it will take it automatically.

    • Now write the below Python script to print the message:
      print('Hello World !')
    • To run this python script, Right click and select ‘Run File in Python Console’ option. This will open a console box at the bottom and show the out put there. We can also run using the Green Play Button at the top right corner of the IDE.

    Output:

Share:

Become Ethical Hacker|The 22 most basic commands of Kali Linux|Install kali Linux

The 22 most basic commands of Kali Linux

This is a beginner’s guide to using the Kali interface. We will discuss some of the simplest yet very important commands that we recommend beginners to get comfortable with early on. We will show the syntax to each of these commands and demonstrate how they work.With the knowledge of these commands at your disposal, you’ll begin to learn Kali in no time.

We’ve divided these basic commands into five different 

 
  • General
  • Manipulation
  • Reading commands
  • Editing commands
  • Permission commands

Category 1: General

Let’s begin with the general commands first.

1. uname: Get detailed info on your system specifications with this command. Great place to start familiarizing yourself with Kali User Interface.

uname --help

2. pwd: This command prints the name of the working directory

pwd

A convenient way of showing the directory you’re working in. Especially useful for novices since Kali Linux has a command shell where it’s easy to get lost when you’re in the middle of something complicated.

3. ls: This command Displays what each file contains and the directories they’re stored in. An easy way to view all the contents (files) contained in a directory

ls

The -l  flag details each category, other than that, you can use -an attribute.

4. history: Get to know all the previously used commands and attributes with history command. It lists all the previous commands you entered (stored in bash shell).

history --help

5. macchanger:macchanger changes your mac address, essentially changing your identity.

It helps with protecting your anonymity on the internet, making your IP untraceable.

macchanger --help

6. ifconfig :ifconfig <=> interface configuration.

Lets you view current network interface settings and configure them.

ifconfig

7. echo: It’s like the basic print function you learned in GW basic. Prints any text to where you direct it to.

echo > [file name]  prints the copied text in a new file.
echo >> [file name]  prints the copied text to an existing file.
Using echo  without a ‘>’ will automatically create a new file for the text.

echo I am Younis Said

8. cat: Lets your read files and link them together, exchange their contents, etc.

Commonly used in Linux.

cat --help

9. Clear: Pretty self-explanatory, clears the terminal screen, and lets you fill it anew.

Category 2: Manipulation commands:

Manipulation commands let you make modifications to files and their content.s

10. mkdir:Creates a new directory.

To create a directory under Desktop called folder1, open a terminal and type this:

mkdir kalitesting

11. cd:changes the directory you’re working in. Very commonly used, and a very convenient way to shift directories.

cd ./kalitesting

12. cp:Serves the basic copy-text/something purpose. Use this to copy one or more files to a location of your choice. You can pretty much move entire directories with this command.

cp --help

13. mv:This command moves files between directories.

mv --help

14. rm:Very basic yet essential command, rm removes highlighted texts.

rm --help

PART THREE: Reading Commands

You get access to files with the following commands.

15. more:more gives you bird’s eye view of the contents of a file.

more --help

Use more to view contents in a file in a convenient manner, one page at a time instead of making you scroll down the whole thing.

16. less:does everything that more does, just saves you some RAM while it’s at it. Shows you what’s going on with a certain file, except it doesn’t completely load it.

less --help

17. sort:see information sorted, to see contents in a certain orderly arrangement. Use -r switch, to sort the contents in reverse order.

sort --help

PART FOUR: Editing Commands

Edit  your text files with either one of the following text editors:


Share:

software development company in India |Domainhostly|W3appdevelopers|TrainingTrains|919698548633


ЁЭХКЁЭХаЁЭХЧЁЭХеЁЭХиЁЭХТЁЭХгЁЭХЦ ЁЭХГЁЭХЪЁЭХдЁЭХе
1)Food Delivery App
2)TAXI Booking App
3)eCommerce App
4)Dream 11 Game app,web
5)Dr . Appointment App
6)Guest Pass
7)Vehicle Management
8)Oyo Rooms
9)Grocery App
10)Coaching Management App
11)Hotel Booking App
12)Online Test series,Quiz App
13)Realestate App,web
14)Event Management Web
15)Matrimonial Web
16)Pharmacy Web,s/w
17)Online Course
18)Fruits & Vegitble e-commerce app
19)POS Software
20)Hr sale
21)Property Portal
23) online Academy
24)Realestate
25)CRM
26)Quiz App
27)Inventory Management System
28)Tik Tok
29(Swiggy clone
30)Urbanclap
31)Multi Vendor  Grocery
32)Snake Game
33)News App
34)Tinder App
35)Netflix
36)Whatsapp Clone
37)OLX Clone
38)School management
39)Social Network
41)OLA
42)Multi Recharge Portal
43)Single lag MLM
46)Gift Plan
47) Aeps & Multi Recharge Portal
48)Hospital Management System
49)Blood Donation System
50)Inventory Softeare
51)Biling Software (With GST, Without GST)
52)HRM
53)GYM Management
54)OLX Clone
55)Netflix Web Clone
58)Zoom App Clone
59)Bigbasket Clone
60)Real Estate APP(E-Property Clone )
61)Wedmegood Clone
62)Clinic Appointment Web
63)Hardware Accessories App
64)Mobile Accessories App
65)Ayurvedic Product App
66)CRM Software
67)POS Software
68)PHMS(Pharmacy Management System)
69)Rapido Clone
70)Sayari App
71)Petrol Delivery App
72)Mukti Shop App
75)Hotel Management System
77)Real Estate portal
78)Classified portal
79)Dating Application
80)Instagram Clone
81)Book Directory
82)AMC Software

IT solutions provider for our clients, focusing on Web Solutions, Enterprise Messaging, IT Consultancy, Software Solutions and Cloud Technology Based Products. We have expertise in Web Designing, Web Development, E-commerce, Software Development & Search Engine Optimization. Our motto is to develop creative, professional, easily navigated solution that works in all conditions. Starting from Small Business Vendors to Big Corporate Houses, we have solution for all.
If you have any query please do contact us on or  for more details
Get a Premium High-End Designed Website @ Best Price
Unlimited  Page Website + Super-Fast Hosting + SSL Certificate + Business Email + SEO Optimized + Dedicated Suport & Management + E-Commerce Online Store with Payment Gateway + Google Analytic

I'm a website developer,
I can design any kind of website;
1. Online Shop website
2. Mobile Application Website
3. Courier/Shipping/Tracking/Logistics Website
4. E-commerce website
5. Company Website
6. School/Coaching       website
7. Hospitals/Farmacy website
8. MLM website
9. Hotels/Booking websites
10. Photography Website
11. Computer Hardware WebSite
13. Live Streaming Website
14. Ebook Website
15. Factory Website
16. Online Form Website
17.University Website
18. Personal Blog
19. City Website
20. Portofolio and etc
It comes with,
1.Latest Designs
2.Simple to use Admin Area
3.Language Translator
4.SSL Security
5.Live Chat System
6.One(1) Year Hosting and Domain for free 
7.Customized Emails
8.Company Verification Link and Certificate

роЙроЩ்роХро│் роХроЯை рооро▒்ро▒ுроо் ро╡ிропாрокாро░род்родிро▒்роХு Website & Android App роХுро▒ைрои்род ро╡ிро▓ைропிро▓் роЪெроп்родு роХொроЯுроХ்роХрок்рокроЯுроо்
родройிроирокро░் рооро▒்ро▒ுроо் роиிро▒ுро╡ройроЩ்роХро│ுроХ்роХுрод் родேро╡ைропாрой

1. Website Design
2. Online Shopping 
3. Web Application Design
4. Android apps
5. Software Development
*рокோрой்ро▒ро╡ро▒்ро▒ை рооிроХро╡ுроо் родро░рооாроХро╡ுроо், ро╡ிро▓ை роХுро▒ைро╡ாроХро╡ுроо் роЪெроп்родு родро░ுроХிрой்ро▒ோроо்.*

ро╡ாроЯிроХ்роХைропாро│ро░்роХро│ிрой் ро╡ிро░ுрок்рокрод்родிро▒்роХேро▒்рок роЯிро╕ைрой் роЪெроп்родு родро░рок்рокроЯுроо்..

https://g.page/r/Ce75IQ-Wyn5tEA0

Happy news new client application business live.Thanks to our  all people...
Kindly check and  verify our works
Our  Happy customers
Makkal Mart
Started business:
https://play.google.com/store/apps/details?id=com.makkalmart.users

Software Training Institute in Coimbatore | Erode- Mullamparappu Training Trains
Software Training institute in erode, Mullamparappu

INTERNSHIP TRAINING|IN- PLANT TRAINING |Software Training Institute|Software development Company|Webhosting company
I will Train u Java, Blockchain, Machine Learning, Meanstack, Artifical Intelligence, Kotlin, Cloud Computing, Angular, React, IOT, DevOps, PHP, .Net, Big Data and Hadoop, Spark, Data Analytics, R Programming, SEO and Digital Marketing, Android, Python, Oracle, Web Designing, Spring, Hibernate, Software Testing, Seleninum, Linux, C and
C++  Python , Ethical Hacking  and many more technologies.

Contact Trainer:
K.Boopathikumar
(Full stack developer/data science)
CEO/ Founder
Training Trains
919698548633


Share:

Live Chat With Us

My Blog List

Search This Blog

Locations

Training

Pages

My Blog List

Blog Archive

Privacy policy