136k views
2 votes
Prefixes = "BCFHMPRSVT"

suffix = "at"
for p in prefixes:
print(p + suffix)
Since Tat is not a word, the program needs to be changed to print That instead of Tat. Add a conditional statement to make the program print That instead of Tat.

2 Answers

5 votes

Final answer:

To make the program print 'That' instead of 'Tat', a conditional statement can be added to check if p is equal to 'T'.

Step-by-step explanation:

To make the program print 'That' instead of 'Tat', we can add a conditional statement to check if p is equal to 'T'. If it is, we can concatenate 'h' with the suffix instead of 'a', resulting in 'That'. Here's the modified code:

prefixes = 'BCFHMPRSVT'
suffix = 'at'
for p in prefixes:
if p == 'T':
print(p + 'h' + suffix)
else:
print(p + suffix)

User Krishnaacharyaa
by
3.8k points
2 votes

Answer:

prefixes = "BCFHMPRSVT"

suffix = "at"

for p in prefixes:

if p == "T":

print("That")

else:

print(p + suffix)

User Yaobin Then
by
3.0k points