12th Cs ch-1 Python Revision Tour-1
12th Cs ch-1 Python Revision Tour-1
• Assignment =
• Assign Quotient /=
• Assign Sum +=
• Assign Product *=
• Assign Remainder %=
• Assign Difference -=
• Assign Exponent **=
• Assign Floor Division //=
Membership Operator
• Whether variable in sequence in
• Whether variable not in sequence not in
Punctuator
• To overcome the above error we need to convert the string type object
to integer or any desired numeric type.
• input( ) function always returns a value of string type.
• Use int( ) or float( ) function to convert the type string to int and float
respectively.
Possible Errors while Reading Numeric
Values
• When converting variable to int/float we need to make sure that the
value entered is of int/float type.
• Both the loops of Python has else clause. The else of a loop
executes only when the loop end normally( i.e. only when the loop
is ending because the while loop’s test condition has become false
and for loop has executed the last sequence)
• Note: The else clause of the Python Loop executes when the loop
terminates normally, not when the loop is terminating because of
break statements.
Jump Statement
• You might face a situation in which you need to exit a loop completely
when an external condition is triggered or there may also be a situation
when you want to skip a part of the loop and start next execution.
• Python provides break and continue statements to handle such situations
and to have good control on your loop.
The break Statement:
• The break statement in Python terminates the current
loop and resumes execution at the next statement
The continue Statement:
• The continue statement in Python returns the control to the
beginning of the while loop. The continue statement rejects all the
remaining statements in the current iteration of the loop and moves
the control back to the top of the loop.
Nested Loop