id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

bryce.hulett@hotmail.com > confidence
prev  |  next  |  chance

Modified From PY4E (chapter 6, ex 5): Write a function that takes a string as a parameter. The end of the string will contain a colon followed by a real (floating point) number. Return the floating point number. confidence('X-DSPAM:Confidence:0.8475') -> returns 0.8475 Use rfind and string slicing to extract the portion of the string after the colon character and then use the float function to convert the extracted string into a floating point number.


confidence('X-DSPAM:Confidence:0.8475') → 0.8475
confidence('X-DSPAM:Confidence:0.12') → 0.12
confidence('X-DSPAM:Confidence:0.99') → 0.99

...Save, Compile, Run (ctrl-enter)

def confidence(s):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 100 Post-solution available

Copyright Nick Parlante 2017 - privacy