Type Specifier for Boolean in C++

Govinda Sai
Updated on 26-Feb-2020 11:15:59

269 Views

The type specifier for boolean in c++ is bool. You can use it as −bool myBoolean = true;

Indent Multiple If-Else Statements in Python

Malhar Lathkar
Updated on 26-Feb-2020 11:11:26

3K+ Views

Use of indented blocks is an important feature of Python. Indent level of the block is more than previous statements. Hence, if multiple if statements are present in a program in nested fashion, each subsequent indented block will have increasing level of indent.if expr1==True:     if expr2==True:         stmt1     else:          if expr3==True:         stmt2 else:     if expr3==True:        stmt3     else:        stmt4

List Insert in C++ STL

Sunidhi Bansal
Updated on 26-Feb-2020 11:10:18

9K+ Views

Given is the task to show the functionality list insert( ) function in C++ in STL.What is List in STLList are containers that allow constant time insertion and deletion anywhere in sequence. List are implemented as doubly linked lists. List allow non-contiguous memory allocation. List perform better insertion extraction and moving of element in any position in container than array, vector and deque. In List the direct access to the element is slow and list is similar to forward_list, but forward list objects are single linked lists and they can only be iterated forwards.What is insert( )The list insert( ) ... Read More

Use Break Statement in Python If Clause

Malhar Lathkar
Updated on 26-Feb-2020 11:06:04

232 Views

Python's break keyword is used as decision control statement. It causes the remaining iterations to be abandoned and control of execution goes to next statement after the end of loop. Invariably it is executed conditionally and appears inside if block within a loop.while expr==True:     stmt1         stmt2         if expr2==True:        break     stmt3     stmt4   However it can't be used in an if block if it is not a part of loop. 

Use Continue Statement in Python If Clause

Malhar Lathkar
Updated on 26-Feb-2020 11:05:28

234 Views

Python's continue statement is a loop control statement. It causes starting next iteration of loop after abandoning current iteration. Invariably is is executed conditionally i.e. in if blockwhile expr==True:     stmt1     stmt2     if expr2==True:        continue     stmt3     stmt4However, it can't be used in an if block if it is not a part of loop. If used, interpreter will throw syntax error.

Deque Resize in C++ STL

Sunidhi Bansal
Updated on 26-Feb-2020 11:03:42

269 Views

Given is the task to show the functionality of deque resize( ) function in C++ STL.What is DequeDeque is the Double Ended Queues that are the sequence containers which provides the functionality of expansion and contraction on both the ends. A queue data structure allow user to insert data only at the END and delete data from the FRONT. Let’s take the analogy of queues at bus stops where the person can be inserted to a queue from the END only and the person standing in the FRONT is the first to be removed whereas in Double ended queue the ... Read More

What are the and Operators in Python

Malhar Lathkar
Updated on 26-Feb-2020 10:59:01

266 Views

The symbols > are defined as left and right shift operators respectively in Python. They are bitwise operators. First operand is a bitwise representation of numeric object and second is the number of positions by which bit formation is desired to be shifted to left or right.The >> a=60 >>> bin(a) '0b111100' >>> b=a> b 240 >>> bin(b) '0b11110000'You can see two bits on right set to 0On the other hand >> operator shifts pattern to right. Most significant bits are set to 0>>> a=60 >>> bin(a) '0b111100' >>> b=a>>2 >>> b 15 >>> bin(a) '0b111100'

How Does Operator Work in Python 3

Malhar Lathkar
Updated on 26-Feb-2020 10:58:05

192 Views

The == symbol is defined as equality operator. It returns true if expressions on either side are equal and false if they are not equal>>> (10+2) == 12 True >>> 5*5 == 5**2 True >>> (10/3)==3 False >>> 'computer'=="computer" True >>> 'COMPUTER'.lower()=='computer' True

Purpose of the Operator in Python

Malhar Lathkar
Updated on 26-Feb-2020 10:55:31

784 Views

In Python, // is defined as floor division operator. It returns integer part of a floating point result of division. For example 10//3 returns 3>>> 10//3 3 >>> 125.5//2.5 50.0 >>> 12.5//1.5 8.0However in case of negative division, returned value is rounded towards negative infinity.>>> -10//3 -4 >>> -73//9 -9

List Unique in C++ STL

Sunidhi Bansal
Updated on 26-Feb-2020 10:55:05

419 Views

Given is the task to show the functionality list unique( ) function in C++ in STL.What is List in STLList are containers that allow constant time insertion and deletion anywhere in sequence. List are implemented as doubly linked lists. List allow non-contiguous memory allocation. List perform better insertion extraction and moving of element in any position in container than array, vector and deque. In List the direct access to the element is slow and list is similar to forward_list, but forward list objects are single linked lists and they can only be iterated forwards.What is unique( )The list unique( ) ... Read More

Advertisements