4 Class Input Funtion
4 Class Input Funtion
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"Input Function" is a predefined function which is present inside of default module
( or ) builtin module in python.
*)By using input() we can read the data from keyboard dynamically.
*)If we want read the data in the form of our own format we can use type conversion
functions.
-------------------------PYTHON---------------------------------
example:-a=int(input("enter the data of a="))
b=int(input("enter the data of b="))
print(a+b)
--------------------JAVA---------------------------------------------
import java.io.*;
class Test
{
public static void main(String[] args) throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter a value");
int a=Integer.parseInt(br.readLine());
System.out.println("enter b value");
int b=Integer.parseInt(br.readLine());
System.out.println("addition is:"+(a+b));
}
}
--------------------------------------------------------
SET type convertion:-
--=-=-=-=-=-=-=-=-=--
In set type converstion accepts only set type and results will be displayed in
"{}"(flower brackets).
**output will be "UNORDERED".
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=-=-=-=-=-=-=-=
str handling:
-=-=-=-=-=-=-
*)Group of characters or sequence of characters is also known as a str.
*)Group of characters or sequence of characters can be stored in str class object.
*)We can create str class object in 2 ways:
*)Every character in str class object can be represented with unique index starting
with
zero.
*)if str supports indexes then it automatically supports slicing concept also.