Computer Science, asked by harshit944, 1 year ago

predict the output of class 11th python​

Attachments:

Answers

Answered by UMANGAGRAWAL0123
7

Answer:

I don't know brother check it out on Google

Answered by saipraneeth94
2

Answer:

perm_identity

Output of Python Program | Set 1

Predict the output of following python programs:

Program 1:

r = lambda q: q * 2

s = lambda q: q * 3

x = 2

x = r(x)

x = s(x)

x = r(x)

print x

Output:

24

Explanation : In the above program r and s are lambda functions or anonymous functions and q is the argument to both of the functions. In first step we have initialized x to 2. In second step we have passed x as argument to the lambda function r, this will return x*2 which is stored in x. That is, x = 4 now. Similarly in third step we have passed x to lambda function s, So x = 4*3. i.e, x = 12 now. Again in the last step, x is multiplied by 2 by passing it to function r. Therefore, x = 24.

Program 2:

a = 4.5

b = 2

print a//b

Output:

2.0

Explanation : This type of division is called truncating division where the remainder is truncated or dropped.

Program 3:

a = True

b = False

c = False

if a or b and c:

print "GEEKSFORGEEKS"

else:

print "geeksforgeeks"

Output:

GEEKSFORGEEKS

Explanation : In Python, AND operator has higher precedence than OR operator. So, it is evaluated first. i.e, (b and c) evaluates to false.Now OR operator is evaluated. Here, (True or False) evaluates to True. So the if condition becomes True and GEEKSFORGEEKS is printed as output

Similar questions