Advertisements

Aatul Palandurkar

Archive for the ‘Python Tutorials’ Category

Objectives:

  • How to perform addition in Python?
  • How to do addition in Python?
  • How to add two numbers in Python?
  • How to add numbers in Python?

 

Code:

x=5
y=3
z = x + y
print(x)
print(y)
print(z)

Please refer above code to add numbers in Python and print their values.

 

Steps to Run the above code:

  • Navigate to the folder/directory where you have saved your python code or file.
  • Here I have considered that python file is saved on “c:\>” and the File name is “Addition.py
  • Just type the following command now to execute the Python program: c:\> python Addition.py

 

Download code:

  • Navigate to GitHub repository and download the code from here: Addition.py

 

We conduct Python Training and Workshop for Corporates and College Students, if interested, please write to us on kloudsancyber@gmail.com

 

Aatul Palandurkar
Life Coach, International Trainer, and Author

https://www.facebook.com/aatulpalandurkar
https://www.instagram.com/aatulpalandurkar/

Advertisements

Objectives:

  • How to write comments in Python?
  • How to write single line comments in Python?
  • How to write multiple line comments in Python?
  • What are the types of comments in Python?

 

In Python there are two (2) types of Comments in Python:

  • Single Line Comments
  • Multiple Line of Comments

Comments are statements which are not readable to an interpreter and will not be executed. Basically, comments are used to specify details such as why we have written the block of code, etc.

Single Line Comments are defined using hash sign (#) whereas multiple line comments are defined using three times double quote for opening and closing as mentioned below.

 

Code:

# This is Single Line Comment.


"""
     This
     is
     Multiline
     Comment.
"""

print ("Now I understand comments in python.")

Please refer above code to write comments in Python.

 

Steps to Run the above code:

  • Navigate to the folder/directory where you have saved your python code or file.
  • Here I have considered that python file is saved on “c:\>” and the File name is “Comments.py
  • Just type the following command now to execute the Python program: c:\> python Comments.py

 

Download code:

  • Navigate to GitHub repository and download the code from here: Comments.py

 

We conduct Python Training and Workshop for Corporates and College Students, if interested, please write to us on kloudsancyber@gmail.com

 

Aatul Palandurkar
Life Coach, International Trainer, and Author

https://www.facebook.com/aatulpalandurkar
https://www.instagram.com/aatulpalandurkar/

Objectives:

  • How to write variables in Python?
  • How to create variables in Python?
  • How to add variables in Python?
  • How to define variables in Python?
  • What are the types of variables in Python?

 

Code:

x=5         # int
y=3.5       # float
z="ABC"     # String
print(x)
print(y)
print(z)

Please refer above code to define variables in Python and print their values.

The above code clearly states that there are three (3) types of Variables in Python:

  • int – Integer Values
  • float – Float Values or Decimal Values
  • String – String literals

 

Steps to Run the above code:

  • Navigate to the folder/directory where you have saved your python code or file.
  • Here I have considered that python file is saved on “c:\>” and the File name is “Variables.py
  • Just type the following command now to execute the Python program: c:\> python Variables.py

 

Download code:

  • Navigate to GitHub repository and download the code from here: Variables.py

 

We conduct Python Training and Workshop for Corporates and College Students, if interested, please write to us on kloudsancyber@gmail.com

 

Aatul Palandurkar
Life Coach, International Trainer, and Author

https://www.facebook.com/aatulpalandurkar
https://www.instagram.com/aatulpalandurkar/

Objectives:

  • How to write Hello World in Python?
  • How to print Hello World in Python?
  • How to print a new line in Python?
  • How to print a blank line in Python?
  • How to run the Python Code?
  • How to execute the Python Code?

 

Code:

print("Hello, World!")
print() # prints a new or blank line, works as "\n"
print("Hi")

Please refer above code to print Hello World in Python

 

Steps to Run the above code:

  • Navigate to the folder/directory where you have saved your python code or file.
  • Here I have considered that python file is saved on “c:\>” and the File name is “HelloWorld.py
  • Just type the following command now to execute the Python program: c:\> python HelloWorld.py

 

Download code:

  • Navigate to GitHub repository and download the code from here: 001_Hello.py

 

We conduct Python Training and Workshop for Corporates and College Students, if interested, please write to us on kloudsancyber@gmail.com

 

Aatul Palandurkar
Life Coach, International Trainer, and Author

https://www.facebook.com/aatulpalandurkar
https://www.instagram.com/aatulpalandurkar/


Advertisements

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 13,212 other followers

Tweets

YouTube

Archives

Advertisements
%d bloggers like this: