Showing posts with the label Python revision Tour 1

Are the two fragments logically equivalent? Why or why not?

Q. Consider the following two fragments: if x == 5 :     x = x + 1 else:     x …

If y has value 2 after executing above program fragment, then what do you know

Q. Consider the following code: x = int (input ("Enter the value of 'x…

score = 40 while score > 1: score = score/2 - 1 print(score, end = )

Q. What is the output of the program? score = 40 while score > 1:     score …

x = 7 y = 8 if x < 7 or x <= 10 and y > 8 : print(IT IS!) else: print(Oh No)

Q. What is the output of the following program ? x = 7 y = 8 if x < 7 or x &…

What is output of following python program? First try and predict output without the computer.

Q. What is the output of the following python program? First try and predict th…

Given following Boolean variables, what would be output of following statements?

Q. Given the following Boolean variables, what would be the output of the follo…

x = True y = False z = False print(x or y and z)

Q. What would be the output of the following? x = True y = False z = False prin…

(a) print(type([1,2])) (b) print(type(1,2))

Q. What would be the output of the following? (a) print(type([1,2])) (b) print(…

What would be output produced by print statements given below?

Q. What would be the output produced by the print statements given below? impor…

Which of following statements would yield 2? Assume that math module is imported.

Q. Which of the following statements would yield 2? Assume that math module is …

x = 4 y = 8 z = x / y * y print(z)

Q. What would be the output of following code? Support your answer with reasons…

a = 9000 # initializes and assigns value to variable print (Now its a, type(a))

Q. What would be the output of following code? a = 9000 # initializes and assig…

What does Python print as it executes following sequence of statements?

Q. What does Python print as it executes the following sequence of statements? …

In each of following Python expressions or statements, indicate what data type belongs

Q. In each of the following Python expressions or statements, indicate what dat…

What would be the output of following code?

Q. What would be the output of following code? print ('doesn\'t') p…

While taking input from input(), you need to convert input into float and int types, if you are reading numbers.

Q. While taking input from input(), you need to convert the input into float an…

In each of following parts there is error in Python code. Identify error by name and describe problem.

Q. In each of the following parts there is an error in the Python code. Identif…

Give three examples of legal variable names and two examples of illegal variable names in Python.

Q. Give three examples of legal variable names and two examples of illegal vari…

For each of the following, write a single (that is, one) Python statement

Q. For each of the following, write a single (that is, one) Python statement: (…

Write a program to print a square multiplication table as shown below

Q. Write a program to print a square multiplication table as shown below: 1    …

Load More That is All