Skip to content

Instantly share code, notes, and snippets.

@Ludek1234
Ludek1234 / Simple_trading_rule.ipynb
Created September 26, 2018 18:50
A simple trading rule
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## reverse##\n",
"Define a function called __reverse__ that takes a string text and returns that string in reverse. For example: reverse(\"abcd\") should return \"dcba\".\n",
"\n",
"You may not use __reversed or [::-1]__ to help you with this.\n",
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Write a function called digit_sum that takes a positive integer n as input and returns the sum of all that number's digits. For example: digit_sum(1234) should return 10 which is 1 + 2 + 3 + 4. (Assume that the number you are given will always be positive.)\n",
"\n",
"One way might be to convert the integer to a string with str(), iterate over it, and turn the substrings back into integers with int() to do the addition.\n",
"\n"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.