Академический Документы
Профессиональный Документы
Культура Документы
while condition:
true part statements
1.
.
.
normal statements
Write a Python program to accept two numbers and multiply two numbers and print the result.
a=int(input())
b-int(input())
print(a*b)
Differentiate Pass and Continue
Pass – Does nothing and proceed with the normal execution of next line with respect to the flow
Continue – Skips the current iteration and continues with the next iteration
Define recursion with example.
Recursion is a function that calls by itself repeatedly until the condition is true.
e.g. def fn( ):
2.
.
.
fn( )
Give the difference between Break and Continue statement.
Break – Stops the execution of the entire loop and the normal statement outside of the loop executes.
Continue - Skips the current iteration and continues with the next iteration
What are the types of parameters?
Actual Parameters – Values or variables passed in the function calling statement.
Formal Parameters – Values or variables passed in the function definition statement.
Write a Python program to accept two numbers and find the greatest and print the result.
a=int(input())
b-int(input())
3. if a>=b:
print(“a is big”)
else:
print(“b is big”)
Differentiate Local and global variables.
Local variables – variable that is declared inside a specific function and accessible to the function only
Global variables – variable that is declared outside of the function and accessible inside and outside the
function.
10
The above code prints the location of the files that are storing by default. The entire location up to the
folder “python35-32” will be printed as output. CWD – Current Working Directory
What are command line arguments?
Input can be directly sent as an argument.
10
When the program is running under command prompt then inputs can be passed directly in the
command and can be fetched using "sys" module.