Microsoft Exam Questions

Which code should you use at line 03?

You are creating a Python program that shows a congratulation message to employees on their service anniversary.

You need to calculate the number of years of service and print a congratulatory message.

You have written the following code. Line numbers are included for reference only.

You need to complete the program.

Which code should you use at line 03?

A. print(“Congratulations on” + (int(end)-int(start)) + “years of service!”)

B. print(“Congratulations on” + str(int(end)-int(start)) + “years of service!”)

C. print(“Congratulations on” + int(end – start) + “years of service!”)
D. print(“Congratulations on” + str(end – start)) + “years of service!”)

Explanation:
int must be converted to string