Python Questions - Set 1 Flashcards
What is the difference between method and function ?
Method Associates with class object.
While function works its own
How to print Zen of python
import this
In which language Python is written
Python is written in C language
Python interpreter written in which Language
Python interpreter is written in C language
How to interact Python code with Java code
We have to use Jython language
Python is interpreter based or compiler based
Python is interpreter based
What is interpreter
An interpreter is a program that directly executes the instructions in a high-level language, without converting it into machine code.
How to convert python code to C code
We have to use Cython a language
Which programming language is used by developers of python
Rpython,
Its used by programmers that develop python itself , since it doesn’t need an interpreter
How to get this output without fsrtring ,
if n= 25
My age is 25
n = 25
print(“My age is “,n)
How to write long multiple line code on python console
print(“Hello”);\
print(“To”);\
print(“python”)
What are keyword arguments of print function, give example ?
end=” “
sep=” “
print(“My name is Sundy “, “Dog Khan “,sep=”<> “,end=”#”)
What is the special character in Python
Backlash is an special character in python
What are literals
Constant values or fixed value ,
Values that never change during the whole execution of program
What is the output of this code,
give reasons in support of ur answer ?
mynum = 0o123
type(mynum)
printy(mynum)
int
83
python assumes octal numbers as integers ,
so the code assigns the decimal value 83 to the variable myoctal, and then it prints the value of myoctal using the print function.
How to save octal number in variable
myOctalNumber = 0o123
How to save hexadecimal number in variable
myhexaNumber = 0x123
How to print object class of identifiers ?
We have to use type method()
a = 10
type(a)
How to write below decimal number in short or scientific notation - 0.000005
5e-6 in decimal form = 0.000005
How to write Boolean values in Python
True , False