Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 5,
  6. "metadata": {
  7. "collapsed": false
  8. },
  9. "outputs": [
  10. {
  11. "name": "stdout",
  12. "output_type": "stream",
  13. "text": [
  14. "210\n",
  15. "711\n",
  16. "313\n",
  17. "37\n",
  18. "113\n",
  19. "117\n",
  20. "416\n",
  21. "1218\n"
  22. ]
  23. }
  24. ],
  25. "source": [
  26. "from math import *\n",
  27. "\n",
  28. "def f(x,y):\n",
  29. " result = (x+y) + (pow(10, 1 + int(log10(x+y))) * (x-y))\n",
  30. " print(int(result))\n",
  31. "\n",
  32. " \n",
  33. "f(6,4)\n",
  34. "f(9,2)\n",
  35. "f(8,5)\n",
  36. "f(5,2)\n",
  37. "f(7,6)\n",
  38. "f(9,8)\n",
  39. "f(10,6)\n",
  40. "f(15,3)\n"
  41. ]
  42. }
  43. ],
  44. "metadata": {
  45. "kernelspec": {
  46. "display_name": "Python 3",
  47. "language": "python",
  48. "name": "python3"
  49. },
  50. "language_info": {
  51. "codemirror_mode": {
  52. "name": "ipython",
  53. "version": 3
  54. },
  55. "file_extension": ".py",
  56. "mimetype": "text/x-python",
  57. "name": "python",
  58. "nbconvert_exporter": "python",
  59. "pygments_lexer": "ipython3",
  60. "version": "3.4.3"
  61. }
  62. },
  63. "nbformat": 4,
  64. "nbformat_minor": 0
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement