Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
25 lines (20 loc) · 677 Bytes

File metadata and controls

25 lines (20 loc) · 677 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# -*- coding: utf-8 -*-
"""
Michael Galarnyk
Given the following python statement…
avg_str = 'Average value read: 0.72903'
Use the find() method and string slicing
to extract the potion of the string after
the colon character and then use the float()
function to convert the extracted string
into a floating point value. Save your code
in a file named “parse_float.py”.
"""
avg_str = 'Average value read: 0.72903'
start_pos = avg_str.find(':');
# 1 more since start_po is after :
start_pos = start_pos + 1;
# taking the number portion of the string
number_portion = avg_str[start_pos:];
# typecasting number_portion to float
number_portion = float(number_portion)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.