48 solutions available
Question 2Identifier name cannot be composed of special characters other than ............... .#Hyphen (-)$\text{\textdollar}$Underscore (_)
Question 15What is the result of this statement:10>5 and 7>12 or not 18>3 10TrueFalseNone
Question 16What will be the output of the following Python code?>>> 6*3+4**2//5-8 1314ErrorNone
Question 17What will be the output of the following Python code?>>> a=72.55 >>> b=10 >>> c=int(a + b) >>> c...
Question 1Write a Python command/instruction/statement to display your name.
Question 3Evaluate the following expressions manually:(a) (2 + 3) ** 3 - 6/2(b) (2 + 3) * 5//4 + (4 + 6)/2(c) 12 + (3 * 4 - 6)/3(d) 12 + (3 ** 4 -...
Question 4Evaluate the above expressions by using IDLE as a calculator and verify the results that you get manually.
Question 5Identify invalid variable names from the following, giving reason for each:Group, if, total marks, S.I., volume, tot_strength, #tag,...
Question 6(a)Find the output of the following code:x=3 y=x+2 x+=y print(x,y)
Question 6(b)Find the output of the following code:x=-2 y=2 x+=y y-=x print (x,y)
Question 6(c)Find the output of the following code:a=5 b=2*a a+=a+b b*=a+b print (a,b)
Question 6(d)Find the output of the following code:p=10 q=20 p*=q/3 q+=p+q*2 print (p,q)
Question 6(e)Find the output of the following code:p = 5 % 2 q = p ** 4 r = p // q p+= p + q + r r+= p + q + r q-= p + q * r print(p, q, r)
Question 6(f)Find the output of the following code:p = 21 // 5 q = p % 4 r = p * q p+= p + q - r r*= p - q + r q+= p + q print(p, q, r)
Question 7Write Python expressions equivalent to the following arithmetic/algebraic expressions:(a) a+b2\dfrac{a + b}{2}2a+b(b) 32+932\dfrac{3^2 +...
Question 8Write Python expressions to represent the following situations:(a) Add remainder of 8/3 to the product of 8 and 3.(b) Find the square root...
Question 9What are operators? Give some examples of unary and binary operators.
Question 13What is 'Dynamic Typing' feature in Python?
Question 14Write a function called calculate_area() that takes base and height as an input argument and returns an area of a triangle as an output....
Question 15Modify the above function to take a third parameter called shape type. Shape type should be either triangle or rectangle. Based on the...
Question 16Write a function called print_pattern() that takes integer number as argument and prints the following pattern if the input number is 3:*...
Question 17Write a program that takes amount in dollars, converts it into rupees. It then displays the converted amount.Solutionamount =...
Question 18What would the following code do?a = b = 70
Question 19What is the error in the following code?z, p = 6
Question 20(a)Find out the error(s) in the following code fragment:temperature = 90 Print temperature
Question 20(b)Find out the error(s) in the following code fragment:a = 30 b = a + b print (a And b)
Question 20(c)Find out the error(s) in the following code fragment:a, b, c = 2, 8, 9 print(a, b, c) c, b, a + a, b, c print(a; b; c)
Question 20(d)Find out the error(s) in the following code fragment:x = 24 4 = x
Question 20(e)Find out the error(s) in the following code fragment:Print ("X =" X)
Question 21(a)What will be the output produced by the following code fragment?X = 10 X = X+10 X = X-5 print (X) X, Y = X - 2, 22 print (X, Y)
Question 21(b)What will be the output produced by the following code fragment?first = 2 second = 3 third = first * second print (first, second,...
Question 21(c)What will be the output produced by the following code fragment?side = int (input ('side')) #Side given as 7 area = side * side print...
Question 22"Comments are useful and an easy way to enhance readability and understandability of a program." Elaborate with examples.
Question 23(a)Find errors in the following code fragment.a = 3 print(a) b = 4 print(b) s = a + b print (s)
Question 23(b)Find errors in the following code fragment.Name = "Prateek" Age = 26 print("your name & age are", Name + Age)
Question 23(c)Find errors in the following code fragment.A = 3 S = A + 10 A = "New" Q = A / 10
Question 24Give the output.x = 40 y = x + 1 x, y = 20, y + x print (x, y)
Question 25Give the output.x, y = 20, 60 y, x, y = x, y - 10, x + 10 print (x, y)
Question 26Give the output.a, b = 12, 13 c, b = a * 2, a/2 print(a, b, c)
Question 27Give the output.a, b, c = 10, 20, 30 p, q, r = c - 5, a + 3, b - 4 print("a and b, :", p, q, r)
Question 28Find errors in the following code fragment. (The input entered as XI)c = int (input ("Enter your class:")) print ("Your class is", c)
Question 29Find errors in the following code fragment.cl = input("Enter your class") print("Last year you were in class", cl - 1)
Question 30Write a Python program that accepts radius of a circle and prints its area.Solutionr = float(input("Enter radius of circle: ")) a =...
Question 31Write a Python program that accepts marks in five subjects and outputs average marks.Solutionm1 = int(input("Enter first subject marks:...
Question 32Write a program to find the area of a triangle.Solutionh = float(input("Enter height of the triangle: ")) b = float(input("Enter base of...
Question 33Write a program to input a number and print its first five multiples.Solutionn = int(input("Enter number: ")) print("First five multiples...
Question 34Write a program to read details like name, class, age of a student and then print the details, firstly in the same line and then in...
Question 35Write a program to read three numbers in three variables and swap first two variables with the sums of first and second, second and third...