0
What Is The Default Data Types That python take as input & shows Output?
In C or C+ we need to declare the data types.. but we are not declaring anythin here.. so how it takes input & output
2 Antworten
+ 8
input() always return string.
Depending on what you exactly mean by 'shows output'. Functions/methods return types you tell them to.
+ 1
python has the same data types as C++ as it is based in C++.
python variables go into the interpreter and are converted to C++ variables behind the scenes during runtime.
python determines the type when the variable is initialised.
in python 2 raw_input() returns a string so you must convert it with int() long() float() etc. and input() is another way to write eval(raw_input()) which tries to run the input string as python code and thus convert it to the appropriate type this. is not reccomended
in python 3 input() is the same as raw_input() and raw_input() no longer exists
hope this helps