1 value = "looking" 2 count = 1 3 4 5 6 for i in range (1, len ("value")): if value [i] == 'o' or 'i': count count + 2 7 8 print (count)

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 12RQ
icon
Related questions
Question

Answer it correctly please, MY LAST ATTEMPT. I ll rate accordingly. Do it correct and fast. Typed answer only. Explain well. 

 

The code segment below is supposed to count the number of letter 'o's and
'i's in a string. However, the code has five logic errors. Identify and fix all five errors.
value="looking"
1
2 count = 1
3
4
5
6
7
8 print (count)
for i in range (1, len("value")):
if value [i] == 'o' or 'i':
count = count + 2
Transcribed Image Text:The code segment below is supposed to count the number of letter 'o's and 'i's in a string. However, the code has five logic errors. Identify and fix all five errors. value="looking" 1 2 count = 1 3 4 5 6 7 8 print (count) for i in range (1, len("value")): if value [i] == 'o' or 'i': count = count + 2
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Binary Search Algorithm
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT