1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kozerog [31]
3 years ago
7

Write a function remove_italicized_text that takes one parameter, a string named sentence. The string might contain HTML tags fo

r representing italicized text. An HTML tag is a kind of code that directs the web browser to format content in a particular way.
Computers and Technology
1 answer:
Naddika [18.5K]3 years ago
7 0

Answer:

See explaination

Explanation:

def remove_italicized_text(x):

ans = ""

n = len(x) # length of string

i = 0

while i < n:

if x[i:(i+3)] == "<i>": # check for opening italic html tag

i += 3

cur = ""

while i < n:

if x[i:(i+4)] == "</i>": # check for closing italic html tag

break

cur += x[i]

i += 1

i += 4

ans += cur # add the text between two tags into output string

ans += " " # adding a space between two next

ans += cur # add the text again

else:

ans += x[i]

i += 1

return ans

sentence = "<i>Stony Brook</i>"

print("sentence = " + sentence)

print("Return value: " + remove_italicized_text(sentence))

print("\n")

sentence = "I <i>love</i> SBU, yes I do!"

print("sentence = " + sentence)

print("Return value: " + remove_italicized_text(sentence))

print("\n")

sentence = "Hey <i>Wolfie</i>, he's so fine, we hug him <i>all the time</i>!"

print("sentence = " + sentence)

print("Return value: " + remove_italicized_text(sentence))

print("\n")

sentence = "This text has no italics tags."

print("sentence = " + sentence)

print("Return value: " + remove_italicized_text(sentence))

print("\n")

You might be interested in
Most search engines provide specific pages on which you can search for____ and
vazorg [7]

Answer: c

Explanation: a

7 0
3 years ago
Read 2 more answers
HOW DO I TURN THE CAPS LOCK OFF???? PLEASE HELP IT WONT STOP!!!!
svlad2 [7]

Answer:

Press the caps lock key

Explanation:

7 0
4 years ago
Read 2 more answers
In 2-3 sentences, describe a case where circuit-switching is better than packet-switching?
cupoosta [38]
Because electricity powers everything , electricity can do anything
6 0
3 years ago
PLEASE HELP WILL GIVE BRAINLIEST!
fgiga [73]

Answer:

(1BD.63B851EB851EB851EB85)₁₆

Explanation:

7 0
4 years ago
Read 2 more answers
You wish to use your personal laptop computer at work, but the it department folks will not allow this. the likely reason is tha
Kruka [31]

Answer: Your non-work related use of a laptop could increase vulnerability.

Explanation: Vulnerability is one of the most important and stressed out section in IT, so it's best to decrease that possibility whenever!

I hope this helps!

3 0
2 years ago
Other questions:
  • Which modem settings should be configured on DSL or cable modems?
    14·1 answer
  • What is an effective way to assess user requests for additional features and functions
    10·1 answer
  • What should you do before cleaning the top of a storage battery and rinsing it with fresh water?
    12·1 answer
  • What is an ISP?<br> in computer Networking
    11·2 answers
  • What is the process of designing green buildings called
    9·2 answers
  • Ask the user to input an integer. Print out the next three consecutive numbers. in python
    13·1 answer
  • Write a C program that reads two hexadecimal values from the keyboard and then stores the two values into two variables of type
    15·1 answer
  • If you need to change the typeface of a document, which menu will you choose?
    6·1 answer
  • True or False
    9·1 answer
  • If I bought mine craft p.e. for 7.99 and hook my Micro soft account up, will i get java edition
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!