Showing posts with label Python at TCCI. Show all posts
Showing posts with label Python at TCCI. Show all posts

Tuesday, February 18, 2020

What is use of pass statement in Python?-tccicomputercoaching.com


The pass statement . pass_stmt: "pass". pass is a null operation -- when it is executed, nothing happens.

Use the pass statement to indicate empty functions , classes and loops. With pass, we indicate a "null" block. Pass can be placed on the same line, or on a separate line. Pass can be used to quickly add things that are unimplemented.


Example:

str="Hello"

for i in str:

if i=='H':

pass

print("pass is executed:")

else:

print(i)

Output:


pass is executed

e

l

l

o

To learn more about Python at TCCI.

Call us @ 9825618292

Visit us @ www.tccicomputercoaching.com

Tuesday, June 4, 2019

What is template in C++? tccicomputercoaching.com

Templates are a feature of the C++ programming language that allows functions and classes to operate with generic types. The simple idea is to pass data type as a parameter so that we don’t need to write same code for different data types. Template allows a function or class to work on many different data types without being rewritten for each one.



For example if we want to sum of two different types of numbers then we have to do individual user defined function for each type of data. This increases time and memory space. But using template function we have to write once generic function, so, it will decrease the length and complexity of programme .

To learn more in detail about template in c++ at TCCI.

Call us @ 9825618292

Visit us @ http://tccicomputercoaching.com/workshop/

Friday, April 26, 2019

What is the difference between Bufferreader and InputstreamReader in Java? tccicomputercoaching.com

BufferedReader and InputStreamReader are both Input Function in Java File.

BufferedReader reads a couple of characters from the specified stream and stores it in a buffer. This makes input faster.

InputStreamReader reads only one character from specified stream and remaining characters still remain in the stream.



Example:

1. class NewClass{
2. public static void main(String args[]) throws InterruptedException, IOException{
3.
4. BufferedReader isr = new BufferedReader( new InputStreamReader (System.in));
5.
6. Scanner sc = new Scanner(System.in);
7.
8. System.out.println("B.R. - "+(char )isr.read());
9. System.out.println("Scanner - " + sc.nextLine());
10. }
11. }

When the isr.read() statement is executed, I entered the input ”hello” and the character “h” of “hello” is printed on the screen. If this was InputStreamReader then the remaining characters “ello” would have remained in the System.in stream and the sc.nextLine() would have printed them. But in this case it doesn’t happens because the BufferedReader reads all of the “hello” characters from the System. in stream and stores them in its own personal buffer and thus the System. In stream remains empty when sc.nextLine() is executed.

For more information about Java, C++, Vacation Batch at TCCI , Python at TCCI

Call us @ 9825618292

Visit us @ www.tccicomputercoaching.com