Tutorial on Python: Basic

by September 01, 2020 0 comments

Python has two different versions; python 2 and python 3. In this tutorial, everything will be discussed according to the python 3 version.

=========================================================================

Hello, World!

To print a string in python:

print("Hello, World!")

=========================================================================

Python Indentation

Indentation refers to the spaces at the beginning of a code line.

if a > b:
  print("a is greater than b")           ###This syntax is right

if a > b:
print("a is greater than b")             ###This is wrong syntax

"#" this sign is used in python as a comment when line by line has checked, the comment part has automatically skipped.

=========================================================================

Variables

variables are created when you assign a value to it. These variables are used to store the data. Points to be remembered:

1. Variables name can only be started with letter or underscore 

2.  Variable names are case-sensitive

3.  A variable name cannot start with a number

4. Except alphanumeric, "_" can be used for giving the name of a variable

---------------------------------------------------------------------------------------------------------------------------
y =  "How are you?"

X1 = 25

mean_age = 30

--------------------------------------------------------------------------------

In an one-line you can assign values for multiple variables:

x, y, z = 5"kolkata"7.0

--------------------------------------------------------------------------------

x = "love"
print("I" + x +"Python")

--------------------------------------------------------------------------------

x = "Don't be "
y = "afraid"
z =  x + y
print(z)

--------------------------------------------------------------------------------











Coral_Age_Pics

Developer

Cras justo odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

0 comments:

Post a Comment