Write a Python program that performs the following operations on a string:

ICSE Class 10 Robotics & AI PYQ · 2025 Specimen · Section B

8(iii)Written · 2025 · Section B · 2025 Specimen · 🔁 also 2026

Write a Python program that performs the following operations on a string:

Show SolutionHide Solution↓
original_string = "Artificial Intelligence"

uppercase_string = original_string.upper()
print("Uppercase string:", uppercase_string)

position = original_string.find("Intelligence")
print("Position of 'Intelligence':", position)

new_string = original_string.replace("Artificial", "Machine")
print("New string:", new_string)

starts_with_machine = new_string.startswith("Machine")
print("Starts with 'Machine':", starts_with_machine)

count_i = original_string.count('i')
print("Number of occurrences of 'i':", count_i)
Uppercase string: ARTIFICIAL INTELLIGENCE
Position of 'Intelligence': 11
New string: Machine Intelligence
Starts with 'Machine': True
Number of occurrences of 'i': 4
← Previous question

Browse the free Robotics & AI sample bank