Python break, continue and pass Statements

break Statement:

  1. used to stop the looping statement before the given condition becomes False.
  2. Used only in the looping statements like while or for.

Example for break:
# break example in python
for i in range(1,10):
if i==6:
break
else:
print(i)
Note: Loop Stops when the i value is 6.

continue Statement:

  1. Used to skip the current iteration
  2. Used only in the looping statements like while or for.

# continue example in python
for i in range(1,11):
if i==6:
continue
else:
print(i)

pass Statement

  1. to Stop and proceed while executing the program

# pass example in python
for i in range(1,10):
if i==6:
pass
print(“pass command”)
print(i)

Win Corporate Training
website: http://www.wincorptrg.com
View My Profile

Advertisements

Variable and Datatype in Python

What is Variable?

  • Named memory location used for storing the value in the entered by the user.
  • Stores only one value at a time

What is Datatype?
Datatype determines type of value to be stored.

Description Java Python
Variable Declaration Mandatory Not Mandatory
Datatype int,float,double,char,boolean,long,String str,int,float
Example String sname=”Sanjay” sname=”Sanjay”

Example: Python Variable Declaration
# Variable in python
empno=2002
empName=”Sanjay”
salary=2500.00

print(“Employee details:”)
print(“Employee No. : “, empno)
print(“Employee Name=”, empName)
print(“Salary=”, salary)

Note:
Python supports Dynamic Typing means based on the value stored in the Variable datatype will be automatically assigned to the variable.
type() function is used to Find the variable’s datatype at Run time.
Example: print(“empno – datatype :”, type(empno))

Next Part : Python Calculation

Win Corporate Training
website: http://www.wincorptrg.com
View My Profile

How to Hide Formulas in Excel

Excel Worksheet contains lot of formulas and Functions.  When ever your sending the file for review we need to hide the formulas from viewing.  Follow the steps to hide formulas

  1.  Select All the Cells in the entire worksheet [use Ctrl + A ].
  2. Home tab Format -> Format Cells -> Protection Tab and Uncheck the Locked and Hidden Check box.
  3. Select the Cells which contains Formulas and Functions.
  4. Home tab Format -> Format Cells -> Protection Tab and Check the Locked and Hidden Check boxes.
  5. Review Tab -> Protect Sheet Option
  6. Type Password to Protect the Sheet. [Note Only values are visible and Formula will be hidden]

Keep Learning
Win Corporate

Website: http://www.wincorptrg.com
profile: http://www.urbanpro.com/bangalore/vijayalakshmi-g-m/626432

Ctrl + Enter Magic

Do you know Ctrl + Enter can be used to fill contents and formula in all the selected cells at one shot!!!!.

  • To Fill the Cells with Common Contents
  1. Select All the cells where you need to fill the contents.
  2. Type the content in the first cell like “Win”.
  3. Press Ctrl+Enter to fill all the Cells with Win!!!!.

To Fill the Cells with Formulas

  1. Select All the cells where you need to fill the formulas
  2. Type the formula in the First Cell.
  3. Press Ctrl+Enter to fill all the Cells with Formula.

Keep Learning
Win Corporate

Website: http://www.wincorptrg.com
profile: http://www.urbanpro.com/bangalore/vijayalakshmi-g-m/626432