Example #1
0
someone else solve a problem.  This book assumes that 
everyone needs to know how to program ...
</pre>
The sum for the sample text above is <b>27486</b>.
The numbers can appear anywhere in the line.  There can be any number of 
numbers in each line (including none).
</p>
<b>Handling The Data</b>
<p>
The basic outline of this problem is to read the file, look for integers using the
<b>re.findall()</b>, looking for a regular expression of <b>'[0-9]+'</b> and then 
converting the extracted strings to integers and summing up the integers.
</p>
<p>
<?php 
httpsWarning($sample_url);
?>
<b>Turn in Assignent</b>
<form method="post">
Enter the sum from the actual data and your Python code below:<br/>
Sum: <input type="text" size="20" name="sum"> (ends with <?php 
echo $actual_sum % 1000;
?>
)
<input type="submit" value="Submit Assignment"><br/>
Python code:<br/>
<textarea rows="20" style="width: 90%" name="code"></textarea><br/>
</form>
</p>
<b>Optional: Just for Fun</b>
<p>
Example #2
0
<pre>
<a href="<?php 
echo $google_api;
?>
" target="_blank"><?php 
echo $google_api;
?>
</a>
</pre>
Singe Google's data is always changing, the data returned from the Google API
could easily be different than from my local copy API.  And the Google
API has rate limits.  But your code should work with the Google API 
with no modifications other than the base URL.
</p>
<?php 
httpsWarning($api_url);
?>
<p><b>Test Data / Sample Execution</b></p>
<p>
You can test to see if your program is working with a 
location of "<?php 
echo $sample_location;
?>
" which will have a 
<b>place_id</b> of "<?php 
echo $sample_place;
?>
".
<pre>
$ python solution.py
Enter location: <?php