diff options
| author | Syndamia <kami02882@gmail.com> | 2019-08-17 17:49:01 +0300 |
|---|---|---|
| committer | Syndamia <kami02882@gmail.com> | 2019-08-17 17:49:01 +0300 |
| commit | 62b00e6995b388268aef92876d9682b42b1ad2bb (patch) | |
| tree | aac49374d68c53d6a47eee7f011faccda693c831 | |
| parent | dfd68eb97e71ffe1f693526ba3daddd4c9558ce5 (diff) | |
| download | Self-learning-62b00e6995b388268aef92876d9682b42b1ad2bb.tar Self-learning-62b00e6995b388268aef92876d9682b42b1ad2bb.tar.gz Self-learning-62b00e6995b388268aef92876d9682b42b1ad2bb.zip | |
Did Happy numbers task (karan/Projects) in Python
| -rw-r--r-- | Python/.idea/Python.iml | 2 | ||||
| -rw-r--r-- | Python/.idea/misc.xml | 2 | ||||
| -rw-r--r-- | Python/.idea/workspace.xml | 109 | ||||
| -rw-r--r-- | Python/Beginner training/.idea/Beginner training.iml | 2 | ||||
| -rw-r--r-- | Python/Beginner training/.idea/misc.xml | 4 | ||||
| -rw-r--r-- | Python/Beginner training/Tasks.py | 41 |
6 files changed, 153 insertions, 7 deletions
diff --git a/Python/.idea/Python.iml b/Python/.idea/Python.iml index 3f73144..5d30fab 100644 --- a/Python/.idea/Python.iml +++ b/Python/.idea/Python.iml @@ -5,7 +5,7 @@ <excludeFolder url="file://$MODULE_DIR$/venv" /> <excludeFolder url="file://$MODULE_DIR$/venv1" /> </content> - <orderEntry type="jdk" jdkName="Python 3.7 (venv1)" jdkType="Python SDK" /> + <orderEntry type="jdk" jdkName="Python 3.7" jdkType="Python SDK" /> <orderEntry type="sourceFolder" forTests="false" /> </component> <component name="TestRunnerService"> diff --git a/Python/.idea/misc.xml b/Python/.idea/misc.xml index 112e751..a2e120d 100644 --- a/Python/.idea/misc.xml +++ b/Python/.idea/misc.xml @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> - <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (venv1)" project-jdk-type="Python SDK" /> + <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7" project-jdk-type="Python SDK" /> </project>
\ No newline at end of file diff --git a/Python/.idea/workspace.xml b/Python/.idea/workspace.xml index 78082d3..b3a37a2 100644 --- a/Python/.idea/workspace.xml +++ b/Python/.idea/workspace.xml @@ -2,8 +2,10 @@ <project version="4"> <component name="ChangeListManager"> <list default="true" id="fa33c027-ed35-40de-9bbc-c9cf5acfc8e7" name="Default Changelist" comment=""> - <change afterPath="$PROJECT_DIR$/Beginner training/Caeser Cypher.py" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/.idea/Python.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/Python.iml" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/Beginner training/.idea/Beginner training.iml" beforeDir="false" afterPath="$PROJECT_DIR$/Beginner training/.idea/Beginner training.iml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Beginner training/Tasks.py" beforeDir="false" afterPath="$PROJECT_DIR$/Beginner training/Tasks.py" afterDir="false" /> </list> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> @@ -12,6 +14,22 @@ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="LAST_RESOLUTION" value="IGNORE" /> </component> + <component name="FileEditorManager"> + <leaf> + <file pinned="false" current-in-tab="true"> + <entry file="file://$PROJECT_DIR$/Beginner training/Tasks.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="272"> + <caret line="67" lean-forward="true" selection-start-line="67" selection-end-line="67" /> + <folding> + <element signature="e#0#10#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + </file> + </leaf> + </component> <component name="FileTemplateManagerImpl"> <option name="RECENT_TEMPLATES"> <list> @@ -22,17 +40,46 @@ <component name="Git.Settings"> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." /> </component> + <component name="ProjectFrameBounds" extendedState="6"> + <option name="x" value="-7" /> + <option name="width" value="974" /> + <option name="height" value="1047" /> + </component> <component name="ProjectId" id="1OddUdJn47AFLBgIxJzF9yYmR9b" /> <component name="ProjectLevelVcsManager" settingsEditedManually="true"> <ConfirmationsSetting value="2" id="Add" /> </component> + <component name="ProjectView"> + <navigator proportions="" version="1"> + <foldersAlwaysOnTop value="true" /> + </navigator> + <panes> + <pane id="Scope" /> + <pane id="ProjectPane"> + <subPane> + <expand> + <path> + <item name="Python" type="b2602c69:ProjectViewProjectNode" /> + <item name="Python" type="462c0819:PsiDirectoryNode" /> + </path> + <path> + <item name="Python" type="b2602c69:ProjectViewProjectNode" /> + <item name="Python" type="462c0819:PsiDirectoryNode" /> + <item name="Beginner training" type="462c0819:PsiDirectoryNode" /> + </path> + </expand> + <select /> + </subPane> + </pane> + </panes> + </component> <component name="PropertiesComponent"> <property name="ASKED_ADD_EXTERNAL_FILES" value="true" /> <property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" /> <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" /> <property name="ToolWindowRun.ShowToolbar" value="false" /> <property name="ToolWindowServices.ShowToolbar" value="false" /> - <property name="last_opened_file_path" value="$PROJECT_DIR$/Beginner training/Caeser Cypher.py" /> + <property name="last_opened_file_path" value="$PROJECT_DIR$" /> <property name="restartRequiresConfirmation" value="false" /> <property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" /> </component> @@ -53,7 +100,7 @@ </list> </option> </component> - <component name="RunManager" selected="Python.Caeser Cypher"> + <component name="RunManager" selected="Python.Tasks"> <configuration default="true" type="CompoundRunConfigurationType"> <toRun name="Basic synthax config" type="PythonConfigurationType" /> <toRun name="2 Pets config" type="PythonConfigurationType" /> @@ -259,18 +306,62 @@ <is-autoscroll-to-source value="true" /> </todo-panel> </component> + <component name="ToolWindowManager"> + <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" /> + <editor active="true" /> + <layout> + <window_info id="Favorites" side_tool="true" /> + <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.119936034" /> + <window_info id="Structure" order="1" side_tool="true" weight="0.25" /> + <window_info anchor="bottom" id="Version Control" order="0" /> + <window_info anchor="bottom" id="Python Console" order="1" /> + <window_info anchor="bottom" id="Terminal" order="2" /> + <window_info anchor="bottom" id="Event Log" order="3" side_tool="true" /> + <window_info anchor="bottom" id="Message" order="4" /> + <window_info anchor="bottom" id="Find" order="5" /> + <window_info anchor="bottom" id="Run" order="6" /> + <window_info anchor="bottom" id="Debug" order="7" weight="0.4" /> + <window_info anchor="bottom" id="Cvs" order="8" weight="0.25" /> + <window_info anchor="bottom" id="Inspection" order="9" weight="0.4" /> + <window_info anchor="bottom" id="TODO" order="10" /> + <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> + <window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> + <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> + <window_info anchor="right" id="Run Dashboard" order="3" weight="0.32889125" /> + </layout> + </component> <component name="Vcs.Log.Tabs.Properties"> <option name="TAB_STATES"> <map> <entry key="MAIN"> <value> <State> + <option name="RECENTLY_FILTERED_USER_GROUPS"> + <collection /> + </option> + <option name="RECENTLY_FILTERED_BRANCH_GROUPS"> + <collection /> + </option> <option name="COLUMN_ORDER" /> </State> </value> </entry> </map> </option> + <option name="RECENT_FILTERS"> + <map> + <entry key="Branch"> + <value> + <list /> + </value> + </entry> + <entry key="User"> + <value> + <list /> + </value> + </entry> + </map> + </option> </component> <component name="XDebuggerManager"> <breakpoint-manager> @@ -292,4 +383,16 @@ </breakpoints> </breakpoint-manager> </component> + <component name="editorHistoryManager"> + <entry file="file://$PROJECT_DIR$/Beginner training/Tasks.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="272"> + <caret line="67" lean-forward="true" selection-start-line="67" selection-end-line="67" /> + <folding> + <element signature="e#0#10#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + </component> </project>
\ No newline at end of file diff --git a/Python/Beginner training/.idea/Beginner training.iml b/Python/Beginner training/.idea/Beginner training.iml index 85c7612..fa80a76 100644 --- a/Python/Beginner training/.idea/Beginner training.iml +++ b/Python/Beginner training/.idea/Beginner training.iml @@ -4,7 +4,7 @@ <content url="file://$MODULE_DIR$"> <excludeFolder url="file://$MODULE_DIR$/venv" /> </content> - <orderEntry type="inheritedJdk" /> + <orderEntry type="jdk" jdkName="Python 3.7" jdkType="Python SDK" /> <orderEntry type="sourceFolder" forTests="false" /> </component> <component name="TestRunnerService"> diff --git a/Python/Beginner training/.idea/misc.xml b/Python/Beginner training/.idea/misc.xml new file mode 100644 index 0000000..a2e120d --- /dev/null +++ b/Python/Beginner training/.idea/misc.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7" project-jdk-type="Python SDK" /> +</project>
\ No newline at end of file diff --git a/Python/Beginner training/Tasks.py b/Python/Beginner training/Tasks.py index 3ba4354..5c0bdcb 100644 --- a/Python/Beginner training/Tasks.py +++ b/Python/Beginner training/Tasks.py @@ -18,6 +18,7 @@ def Divide(): print(round(p2 * 100 / cycle_n, 2), "%") print(round(p3 * 100 / cycle_n, 2), "%") + def Histogram(): cycle_n = int(input("Type number of numbers that will be typed: ")) p1 = 0; p2 = 0; p3 = 0; p4 = 0; p5 = 0 @@ -42,6 +43,7 @@ def Histogram(): print(round(p4 * 100 / cycle_n, 2), "%") print(round(p5 * 100 / cycle_n, 2), "%") + def NumberMatrix(): size = int(input("Type size of matrix: ")) @@ -56,6 +58,7 @@ def NumberMatrix(): else: print() + def Factoriel(): factoriel_n = int(input("Type times of factoriel: ")) @@ -66,7 +69,43 @@ def Factoriel(): print(final_int) +def HappyNumber(): + while True: + start = int(input("Type a start number: ")) + + try: + num = start + seen = [num] + + while num != 1: + + temp = 0 + for c in str(num): + temp += math.pow(CharToNum(c), 2) + num = int(temp) + + if seen.count(num) > 0: raise() + seen.append(num) + + print("{0} is a happy number.".format(start)) + except: + print("{0} isn't a happy number.".format(start)) + + +def CharToNum(char): + if char == "0": return 0 + elif char == "1": return 1 + elif char == "2": return 2 + elif char == "3": return 3 + elif char == "4": return 4 + elif char == "5": return 5 + elif char == "6": return 6 + elif char == "7": return 7 + elif char == "8": return 8 + elif char == "9": return 9 + #Divide() #Histogram() #NumberMatrix() -#Factoriel()
\ No newline at end of file +#Factoriel() +HappyNumber() |
