This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def isPalindrome(txt, printVars=False): | |
''' | |
Python function accepting string input and optional | |
switch to print out the local variables used | |
in determining True/Flase is string a palindrome. | |
Usage: 1) isPalindrome('abcba') => True | |
2) isPalindrome('abcba', True) => True + vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% comment %}Inputs: total and count{% endcomment %} | |
{% assign total = 51 %} | |
{% assign count = 11 %} | |
{% comment %}Get full floating point average (i.e. 4.63636364){% endcomment %} | |
{% assign avg_full = total | times:1.0 | divided_by:count %} | |
avg full: {{ avg_full }}<br /> | |
{% comment %}Make string array of full average * 10 splitting at decimal{% endcomment %} | |
{% assign avg_array = avg_full | times: 10.0 | escape | split:"." %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dict_to_querystring(_dict): | |
return u'&'.join([u'{}={}'.format(k, v) for k, v in _dict.items()]) |