The code given below accepts five numbers and displays whether they are even or odd:
Observe the following code carefully and rewrite it after removing all syntax and logical errors.
Underline all the corrections made.
def EvenOdd()
for i in range(5):
num=int(input("Enter a number")
if num/2==0:
print("Even")
else:
print("Odd")
EvenOdd()
Corrected Code:
def EvenOdd(): # Added colon at the function definition
for i in range(5): # No change
num = int(input("Enter a number: ")) # Added a colon and closed the parenthesis
if num % 2 == 0: # Changed division '/' to modulus '%' for even check
print("Even") # No change
else:
print("Odd") # No change
EvenOdd() # No change
Corrections Made:
: after the function definition def EvenOdd().input("Enter a number: ")./ with the modulus operator % in the condition: if num % 2 == 0.The SELECT statement when combined with \(\_\_\_\_\_\_\) clause, returns records without repetition.
print(16 * 5 / 4 * 2 / 5 - 8)
myStr[:4] extracts the first 4 characters, which are "MISS".myStr[-5:] extracts the last 5 characters, which are "SIPPI"."#" in between, resulting in "MISS#SIPPI".In SQL, the aggregate function which will display the cardinality of the table is \(\_\_\_\_\_\).
print(16 * 5 / 4 * 2 / 5 - 8)
a = 20
def convert(a):
b = 20
a = a + b
convert(10)
print(a)
Select the correct output from the given options:
Fill in the blank:
\(\_\_\_\_\_\_\_\_\) is a set of rules that needs to be followed by the communicating parties in order to have a successful and reliable data communication over a network.