Read Time: 5 min 29 sec
Python is a high-level programming language that's simple to learn and broadly utilized for web advancement, data analysis, manufactured insights, and numerous other applications. Since of its straightforwardness, it is broadly utilized. This instructional exercise will talk about the essential sentence structure in Python and how to type in your to begin with program in Python
Basic Syntax in Python:
#This is a comment print("Hello, Let's begin your Journey for becoming a Data Scientist!")
mathlete = 5 #variable deepdiver = "Andrew Ng" #variable print(mathlete) print(deepdiver)
There are several built-in data types in Python, including:
mathmogul = 5 # integer numeralninja = 2.5 # float brainbooster = "AlmaBetter" # string boolean = True # boolean print(type(mathmogul)) print(type(numeralninja)) print(type(brainbooster)) print(type(boolean))
print(5 + 6) # addition print(4 - 3) # subtraction print(6 * 5) # multiplication print(6 / 5) # division print(7 % 5) # modulus print(5 ** 3) # exponentiation print(4 == 2) # equal to print(4 != 2) # not equal to print(6 > 4) # greater than print(5 < 2) # less than print(6 >= 6) # greater than or equal to print(3 <= 5) # less than or equal to print(3 > 2 and 8 < 10) # logical and print(4 > 6 or 9 < 10) # logical or print(not(3 > 4)) # logical not
Steps for Python Programming
👉 Step 1️⃣: Setting up Google Colab To get started, go to the Google Colab website at 🔗 https://colab.research.google.com/. You will need to sign in with your Google account. Once you are signed in, you can create a new notebook by clicking "New Notebook" or open an existing notebook from your Google Drive where you want to write Code.
👉Step 2️⃣: Writing your first Python program As soon as you click on the new notebook, your colab will appear, where you can see one code cell is already present. In the first cell of the notebook, type the following Code:
print("Hello, Future Data Scientist!") coursework=input("Write text which you want to show to the user in output")
This is a very simple program that just prints the phrase "Hello, Future Data Scientist!" to the console. Python has a built-in function called "print()" that allows you to output text to the console whereas “input()” allows to take input from console. These are two functions used for standard input and output in Python.
👉 Step 3️⃣: Running your program
To run your program, simply click on the "play" button located on the left side of the cell or press "Shift+Enter" on your keyboard. You should see the output "Hello, World!" printed to the console below the cell.
👉 Step 4️⃣:Saving your notebook
To save your notebook, click on "File" in the menu bar and then select "Save" or use the shortcut "Ctrl+S" on Windows or "Cmd+S" on Mac. You can also save your notebook to your Google Drive by clicking on "File" and then "Save a copy in Drive".
👉 Step 5️⃣: Sharing your notebook
If you want to share your notebook with others, you can click on "Share" located in the upper-right corner of the notebook. This will allow you to share your notebook via a link or add collaborators who can view or edit your notebook.
Writing your first Python program in Google Colab is a simple and easy process. With Google Colab, you can write, run and share your Python code without having to install any software on your computer. In Python we have few basic concepts like comments, variables,data types, input and output in python which are mostly used go write your first program to get started.
Answer: b: A high-level programming language
Answer: b: Notes for yourself or other developers that are ignored during program execution
Answer: a: Storing values
Answer: a: Numbers, strings, lists, tuples, sets, dictionaries, booleans
Answer: c: Used to perform operations on variables and values
Related Tutorials to watch
Top Articles toRead