To generate a random integer between 0 and 5, use________________.
Practice Python Libraries Questions – To generate a random integer between 0 and 5, use________________.
Practice Python Libraries Questions – To generate a random integer between 0 and 5, use________________.
Practice Sets Programming – Suppose s = {1, 2, 4, 3}, which of the following is incorrect?
Practice Input-output Questions – Suppose number contains integer value 4, which of the following statement is correct?
Practice Recursion Questions – Which of the following statements are true?
Practice Expressions Questions – Which of the following expressions will yield 0.5?
Practice Python Dictionary Questions – Which of the following statements create a dictionary?
Practice Operators Questions – To add number to sum, you write (Note: Python is case-sensitive)
Practice Method Overriding Questions – Which of the following statements is true?
Practice Recursion Questions – Fill in the code to complete the following function for computing factorial.
def factorial(n):
if n == 0: # Base case
return1
else:
return _____________________ # Recursive call
Practice for loop Questions – Which of the following function returns a sequence 0, 1, 2, 3?
Practice Logical Operators Questions – Which of the following is the correct expression that evaluates to True if the number x is between 1 and 100 or the number is negative?
21. To check whether a char variable ch is an uppercase letter, you write ___________.
Practice Type Conversion Questions – Which of the following functions cause an error?
Practice while loop Questions – Analyze the following code.
count = 0
while count < 100:
# Point A
print(“Welcome to Python!”)
count += 1
# Point B
# Point C
Practice Inheritance Questions – Suppose A is a subclass of B, to invoke the __init__ method in B from A, you write _________.
Practice Sets Programming – Suppose s1 = {1, 2, 4, 3} and s2 = {0, 1, 5, 3, 4, 2, 13}, ________ is true.