diff --git a/test.dddd b/test.dddd new file mode 100644 index 0000000000000000000000000000000000000000..4f28e15b0608e05490da4bdaab0705223e5eebd3 --- /dev/null +++ b/test.dddd @@ -0,0 +1,3 @@ +hello + world +helloworld \ No newline at end of file diff --git a/test.ipynb b/test.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..94f5d4bb29c7b158e2a9155f6f5583bcff0b806b --- /dev/null +++ b/test.ipynb @@ -0,0 +1,125 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "10\n", + "cat miaomiao\n" + ] + } + ], + "source": [ + "# \n", + "# animal\n", + "# cat dog pig ...\n", + "class Object():\n", + " def __init__(self):\n", + " self.id=0\n", + "\n", + "class Animal():\n", + " def __init__(self):\n", + " self.height=1.0 #public\n", + " self._age=10 # protected\n", + " self.__weight=100.0 # private\n", + " \n", + " def talk(self): \n", + " print(self.__age)\n", + "\n", + " pass\n", + "\n", + " \n", + "class Cat(Animal):\n", + " def __init__(self):\n", + " super().__init__()\n", + " pass\n", + " def talk(self):\n", + " print(self._age)\n", + " print(\"cat miaomiao\")\n", + "\n", + "class Dog(Animal):\n", + " def __init__(self):\n", + " pass\n", + " def talk(self):\n", + " print(\"cat wang wang\")\n", + "\n", + "class Pig(Animal):\n", + " def __init__(self):\n", + " pass\n", + " def talk(self):\n", + " print(\"cat aoao\")\n", + "\n", + "cat =Cat()\n", + "cat.talk()\n", + "cat._age\n", + "# dog =Dog()\n", + "# dog.talk()\n", + "# pig =Pig()\n", + "# pig.talk()\n", + "\n", + "\n", + "def talk3times(animal):\n", + " \n", + " animal.talk()\n", + " animal.talk()\n", + " animal.talk()\n", + "\n", + "# talk3times(cat)\n", + "\n", + "def create():\n", + " cat =Cat()\n", + " dog =Dog()\n", + " pass\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "class Convolution_filter:\n", + " def __init__(self,filter_size=3):\n", + " self.filter_size=filter_size\n", + "\n", + " def set_filter_size(self,filter_size=3):\n", + " self.filter_size=filter_size\n", + " pass\n", + " def image_filter(self):\n", + " pass\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.9.12 ('base')", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" + }, + "orig_nbformat": 4, + "vscode": { + "interpreter": { + "hash": "d56fdd98391d50c9892c0eb684d4fbc2504af24585a45598abfbc74a3570fa0a" + } + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/test.py b/test.py index 23a6b9b1c090e75c52ac979365c49e4ee31f4ad2..b42c5da3f411183cd1550d2e926b15a5c7616473 100644 --- a/test.py +++ b/test.py @@ -1,3 +1,10 @@ +# def fab(n): +# if n == 1: +# return 1 +# if n == 2: +# return 1 +# if n > 2: +# return fab(n-1) + fab(n-2) def convert(c): f=(9/7) *c+32 f2=f+10 @@ -7,3 +14,16 @@ c = input("请输入热力学温度1111:") c=eval(c) f = convert(c) print("转换后的华氏温度为:{:.1f}".format(f)) +# def printfablist(n): +# for i in range(1, n+1): +# print(fab(i),end = ' ') +# # printfablist(10) + + +def fab(n): + a,b=1,1 + while a < n: + print(a, end=' ') + a, b = b, a+b + print() +fab(1000)