diff options
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/.idea/Python.iml | 2 | ||||
| -rw-r--r-- | Python/.idea/misc.xml | 2 | ||||
| -rw-r--r-- | Python/.idea/workspace.xml | 314 | ||||
| -rw-r--r-- | Python/Beginner training/001 GoSkiing.py | 12 | ||||
| -rw-r--r-- | Python/Beginner training/002 Pets.py | 18 | ||||
| -rw-r--r-- | Python/Beginner training/003 Hotel.py | 31 | ||||
| -rw-r--r-- | Python/Beginner training/004 TakingCare.py | 15 | ||||
| -rw-r--r-- | Python/Beginner training/011 FitnessEquipment.py | 16 | ||||
| -rw-r--r-- | Python/Beginner training/012 FitnessVisitors.py | 25 | ||||
| -rw-r--r-- | Python/Beginner training/Classes.py | 238 | ||||
| -rw-r--r-- | Python/Beginner training/Exam 1.py | 78 | ||||
| -rw-r--r-- | Python/Beginner training/Exam 2.py | 48 | ||||
| -rw-r--r-- | Python/Beginner training/Random.py | 67 | ||||
| -rw-r--r-- | Python/Beginner training/Tasks.py | 71 |
14 files changed, 599 insertions, 338 deletions
diff --git a/Python/.idea/Python.iml b/Python/.idea/Python.iml index 85c7612..fa80a76 100644 --- a/Python/.idea/Python.iml +++ b/Python/.idea/Python.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/.idea/misc.xml b/Python/.idea/misc.xml index 91eaa2d..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 (Python)" 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 fabcc31..7b967de 100644 --- a/Python/.idea/workspace.xml +++ b/Python/.idea/workspace.xml @@ -2,14 +2,20 @@ <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/001 GoSkiing.py" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/Beginner training/002 Pets.py" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/Beginner training/003 Hotel.py" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/Beginner training/004 TakingCare.py" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/Beginner training/011 FitnessEquipment.py" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/Beginner training/012 FitnessVisitors.py" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/Beginner training/Basic synthax.py" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/Beginner training/Random.py" afterDir="false" /> + <change afterPath="$PROJECT_DIR$/Beginner training/Classes.py" afterDir="false" /> + <change afterPath="$PROJECT_DIR$/Beginner training/Exam 1.py" afterDir="false" /> + <change afterPath="$PROJECT_DIR$/Beginner training/Exam 2.py" afterDir="false" /> + <change afterPath="$PROJECT_DIR$/Beginner training/Tasks.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/001 GoSkiing.py" beforeDir="false" /> + <change beforePath="$PROJECT_DIR$/Beginner training/002 Pets.py" beforeDir="false" /> + <change beforePath="$PROJECT_DIR$/Beginner training/003 Hotel.py" beforeDir="false" /> + <change beforePath="$PROJECT_DIR$/Beginner training/004 TakingCare.py" beforeDir="false" /> + <change beforePath="$PROJECT_DIR$/Beginner training/011 FitnessEquipment.py" beforeDir="false" /> + <change beforePath="$PROJECT_DIR$/Beginner training/012 FitnessVisitors.py" beforeDir="false" /> + <change beforePath="$PROJECT_DIR$/Beginner training/Random.py" beforeDir="false" /> </list> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="SHOW_DIALOG" value="false" /> @@ -19,20 +25,24 @@ </component> <component name="FileEditorManager"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> - <file pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/Beginner training/011 FitnessEquipment.py"> - <provider selected="true" editor-type-id="text-editor"> - <state> - <caret line="3" column="9" lean-forward="true" selection-end-line="3" selection-end-column="9" /> - </state> - </provider> - </entry> - </file> <file pinned="false" current-in-tab="true"> - <entry file="file://$PROJECT_DIR$/Beginner training/012 FitnessVisitors.py"> + <entry file="file://$PROJECT_DIR$/Beginner training/Classes.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="374"> - <caret line="25" lean-forward="true" selection-start-line="25" selection-end-line="25" /> + <state relative-caret-position="170"> + <caret line="234" selection-start-line="234" selection-end-line="234" /> + <folding> + <element signature="e#76#1213#0" /> + <element signature="e#1250#4841#0" /> + <element signature="e#1267#1805#0" /> + <element signature="e#2294#3190#0" /> + <element signature="e#3266#4029#0" /> + <element signature="e#3606#3689#0" /> + <element signature="e#3745#3772#0" /> + <element signature="e#3870#3894#0" /> + <element signature="e#2353#2464#0" /> + <element signature="e#5490#7384#0" /> + <element signature="e#5529#5887#0" /> + </folding> </state> </provider> </entry> @@ -58,24 +68,21 @@ <option value="$PROJECT_DIR$/Beginner training/4 TakingCare.py" /> <option value="$PROJECT_DIR$/Beginner training/005 UniqueCombinations.py" /> <option value="$PROJECT_DIR$/Beginner training/Basic synthax.py" /> - <option value="$PROJECT_DIR$/Beginner training/Random.py" /> + <option value="$PROJECT_DIR$/Beginner training/001 GoSkiing.py" /> + <option value="$PROJECT_DIR$/Beginner training/002 Pets.py" /> + <option value="$PROJECT_DIR$/Beginner training/003 Hotel.py" /> + <option value="$PROJECT_DIR$/Beginner training/004 TakingCare.py" /> + <option value="$PROJECT_DIR$/Beginner training/Exam 1.py" /> <option value="$PROJECT_DIR$/Beginner training/011 FitnessEquipment.py" /> <option value="$PROJECT_DIR$/Beginner training/012 FitnessVisitors.py" /> + <option value="$PROJECT_DIR$/Beginner training/Exam 2.py" /> + <option value="$PROJECT_DIR$/Beginner training/Random.py" /> + <option value="$PROJECT_DIR$/Beginner training/Tasks.py" /> + <option value="$PROJECT_DIR$/Beginner training/Classes.py" /> </list> </option> </component> - <component name="ProjectConfigurationFiles"> - <option name="files"> - <list> - <option value="$PROJECT_DIR$/.idea/Python.iml" /> - <option value="$PROJECT_DIR$/.idea/vcs.xml" /> - <option value="$PROJECT_DIR$/.idea/misc.xml" /> - <option value="$PROJECT_DIR$/.idea/modules.xml" /> - <option value="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" /> - </list> - </option> - </component> - <component name="ProjectFrameBounds"> + <component name="ProjectFrameBounds" extendedState="6"> <option name="x" value="-7" /> <option name="width" value="974" /> <option name="height" value="1047" /> @@ -109,8 +116,9 @@ </component> <component name="PropertiesComponent"> <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="last_opened_file_path" value="$PROJECT_DIR$/Beginner training/012 FitnessVisitors.py" /> + <property name="last_opened_file_path" value="$PROJECT_DIR$/Beginner training/Tasks.py" /> <property name="restartRequiresConfirmation" value="false" /> <property name="settings.editor.selected.configurable" value="preferences.lookFeel" /> </component> @@ -131,7 +139,7 @@ </list> </option> </component> - <component name="RunManager" selected="Python.012 FitnessVisitors"> + <component name="RunManager" selected="Python.Classes"> <configuration default="true" type="CompoundRunConfigurationType"> <toRun name="Basic synthax config" type="PythonConfigurationType" /> <toRun name="2 Pets config" type="PythonConfigurationType" /> @@ -140,70 +148,7 @@ <toRun name="4 TakingCare config" type="PythonConfigurationType" /> <method v="2" /> </configuration> - <configuration name="011 FitnessEquipment" type="PythonConfigurationType" factoryName="Python" folderName="Beginner training" nameIsGenerated="true"> - <module name="Python" /> - <option name="INTERPRETER_OPTIONS" value="" /> - <option name="PARENT_ENVS" value="true" /> - <envs> - <env name="PYTHONUNBUFFERED" value="1" /> - </envs> - <option name="SDK_HOME" value="E:\GitHub repositories\Self-learning\Python\venv\Scripts\python.exe" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/Beginner training" /> - <option name="IS_MODULE_SDK" value="false" /> - <option name="ADD_CONTENT_ROOTS" value="true" /> - <option name="ADD_SOURCE_ROOTS" value="true" /> - <option name="SCRIPT_NAME" value="$PROJECT_DIR$/Beginner training/011 FitnessEquipment.py" /> - <option name="PARAMETERS" value="" /> - <option name="SHOW_COMMAND_LINE" value="false" /> - <option name="EMULATE_TERMINAL" value="false" /> - <option name="MODULE_MODE" value="false" /> - <option name="REDIRECT_INPUT" value="false" /> - <option name="INPUT_FILE" value="" /> - <method v="2" /> - </configuration> - <configuration name="012 FitnessVisitors" type="PythonConfigurationType" factoryName="Python" folderName="Beginner training" nameIsGenerated="true"> - <module name="Python" /> - <option name="INTERPRETER_OPTIONS" value="" /> - <option name="PARENT_ENVS" value="true" /> - <envs> - <env name="PYTHONUNBUFFERED" value="1" /> - </envs> - <option name="SDK_HOME" value="E:\GitHub repositories\Self-learning\Python\venv\Scripts\python.exe" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/Beginner training" /> - <option name="IS_MODULE_SDK" value="false" /> - <option name="ADD_CONTENT_ROOTS" value="true" /> - <option name="ADD_SOURCE_ROOTS" value="true" /> - <option name="SCRIPT_NAME" value="$PROJECT_DIR$/Beginner training/012 FitnessVisitors.py" /> - <option name="PARAMETERS" value="" /> - <option name="SHOW_COMMAND_LINE" value="false" /> - <option name="EMULATE_TERMINAL" value="false" /> - <option name="MODULE_MODE" value="false" /> - <option name="REDIRECT_INPUT" value="false" /> - <option name="INPUT_FILE" value="" /> - <method v="2" /> - </configuration> - <configuration name="1 GoSkiing config" type="PythonConfigurationType" factoryName="Python" folderName="Beginner training"> - <module name="Python" /> - <option name="INTERPRETER_OPTIONS" value="" /> - <option name="PARENT_ENVS" value="true" /> - <envs> - <env name="PYTHONUNBUFFERED" value="1" /> - </envs> - <option name="SDK_HOME" value="E:\GitHub repositories\Self-learning\Python\venv\Scripts\python.exe" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/Beginner training" /> - <option name="IS_MODULE_SDK" value="false" /> - <option name="ADD_CONTENT_ROOTS" value="true" /> - <option name="ADD_SOURCE_ROOTS" value="true" /> - <option name="SCRIPT_NAME" value="E:\GitHub repositories\Self-learning\Python\Beginner training\001 GoSkiing.py" /> - <option name="PARAMETERS" value="" /> - <option name="SHOW_COMMAND_LINE" value="false" /> - <option name="EMULATE_TERMINAL" value="false" /> - <option name="MODULE_MODE" value="false" /> - <option name="REDIRECT_INPUT" value="false" /> - <option name="INPUT_FILE" value="" /> - <method v="2" /> - </configuration> - <configuration name="2 Pets config" type="PythonConfigurationType" factoryName="Python" folderName="Beginner training"> + <configuration name="Basic synthax config" type="PythonConfigurationType" factoryName="Python" folderName="Beginner training"> <module name="Python" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> @@ -215,7 +160,7 @@ <option name="IS_MODULE_SDK" value="false" /> <option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" /> - <option name="SCRIPT_NAME" value="E:\GitHub repositories\Self-learning\Python\Beginner training\002 Pets.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/Beginner training/Basic synthax.py" /> <option name="PARAMETERS" value="" /> <option name="SHOW_COMMAND_LINE" value="false" /> <option name="EMULATE_TERMINAL" value="false" /> @@ -224,19 +169,19 @@ <option name="INPUT_FILE" value="" /> <method v="2" /> </configuration> - <configuration name="3 Hotel config" type="PythonConfigurationType" factoryName="Python" folderName="Beginner training"> + <configuration name="Classes" type="PythonConfigurationType" factoryName="Python" folderName="Beginner training" nameIsGenerated="true"> <module name="Python" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> <envs> <env name="PYTHONUNBUFFERED" value="1" /> </envs> - <option name="SDK_HOME" value="E:\GitHub repositories\Self-learning\Python\venv\Scripts\python.exe" /> + <option name="SDK_HOME" value="" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/Beginner training" /> - <option name="IS_MODULE_SDK" value="false" /> + <option name="IS_MODULE_SDK" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" /> - <option name="SCRIPT_NAME" value="E:\GitHub repositories\Self-learning\Python\Beginner training\003 Hotel.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/Beginner training/Classes.py" /> <option name="PARAMETERS" value="" /> <option name="SHOW_COMMAND_LINE" value="false" /> <option name="EMULATE_TERMINAL" value="false" /> @@ -245,19 +190,19 @@ <option name="INPUT_FILE" value="" /> <method v="2" /> </configuration> - <configuration name="4 TakingCare config" type="PythonConfigurationType" factoryName="Python" folderName="Beginner training"> + <configuration name="Exam 1" type="PythonConfigurationType" factoryName="Python" folderName="Beginner training" nameIsGenerated="true"> <module name="Python" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> <envs> <env name="PYTHONUNBUFFERED" value="1" /> </envs> - <option name="SDK_HOME" value="E:\GitHub repositories\Self-learning\Python\venv\Scripts\python.exe" /> + <option name="SDK_HOME" value="C:\Users\kami0\AppData\Local\Programs\Python\Python37\python.exe" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/Beginner training" /> <option name="IS_MODULE_SDK" value="false" /> <option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" /> - <option name="SCRIPT_NAME" value="E:\GitHub repositories\Self-learning\Python\Beginner training\004 TakingCare.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/Beginner training/Exam 1.py" /> <option name="PARAMETERS" value="" /> <option name="SHOW_COMMAND_LINE" value="false" /> <option name="EMULATE_TERMINAL" value="false" /> @@ -266,19 +211,19 @@ <option name="INPUT_FILE" value="" /> <method v="2" /> </configuration> - <configuration name="Basic synthax config" type="PythonConfigurationType" factoryName="Python" folderName="Beginner training"> + <configuration name="Exam 2" type="PythonConfigurationType" factoryName="Python" folderName="Beginner training" nameIsGenerated="true"> <module name="Python" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> <envs> <env name="PYTHONUNBUFFERED" value="1" /> </envs> - <option name="SDK_HOME" value="E:\GitHub repositories\Self-learning\Python\venv\Scripts\python.exe" /> + <option name="SDK_HOME" value="C:\Users\kami0\AppData\Local\Programs\Python\Python37\python.exe" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/Beginner training" /> <option name="IS_MODULE_SDK" value="false" /> <option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" /> - <option name="SCRIPT_NAME" value="$PROJECT_DIR$/Beginner training/Basic synthax.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/Beginner training/Exam 2.py" /> <option name="PARAMETERS" value="" /> <option name="SHOW_COMMAND_LINE" value="false" /> <option name="EMULATE_TERMINAL" value="false" /> @@ -287,19 +232,19 @@ <option name="INPUT_FILE" value="" /> <method v="2" /> </configuration> - <configuration name="Random config" type="PythonConfigurationType" factoryName="Python" folderName="Beginner training"> + <configuration name="Tasks" type="PythonConfigurationType" factoryName="Python" folderName="Beginner training" nameIsGenerated="true"> <module name="Python" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> <envs> <env name="PYTHONUNBUFFERED" value="1" /> </envs> - <option name="SDK_HOME" value="E:\GitHub repositories\Self-learning\Python\venv\Scripts\python.exe" /> + <option name="SDK_HOME" value="C:\Users\kami0\AppData\Local\Programs\Python\Python37\python.exe" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/Beginner training" /> <option name="IS_MODULE_SDK" value="false" /> <option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" /> - <option name="SCRIPT_NAME" value="$PROJECT_DIR$/Beginner training/Random.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/Beginner training/Tasks.py" /> <option name="PARAMETERS" value="" /> <option name="SHOW_COMMAND_LINE" value="false" /> <option name="EMULATE_TERMINAL" value="false" /> @@ -309,13 +254,10 @@ <method v="2" /> </configuration> <list> - <item itemvalue="Python.012 FitnessVisitors" /> - <item itemvalue="Python.011 FitnessEquipment" /> - <item itemvalue="Python.Random config" /> - <item itemvalue="Python.4 TakingCare config" /> - <item itemvalue="Python.2 Pets config" /> - <item itemvalue="Python.3 Hotel config" /> - <item itemvalue="Python.1 GoSkiing config" /> + <item itemvalue="Python.Tasks" /> + <item itemvalue="Python.Exam 2" /> + <item itemvalue="Python.Exam 1" /> + <item itemvalue="Python.Classes" /> <item itemvalue="Python.Basic synthax config" /> </list> </component> @@ -342,10 +284,10 @@ </todo-panel> </component> <component name="ToolWindowManager"> - <frame x="-7" y="0" width="974" height="1047" extended-state="0" /> + <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" /> <editor active="true" /> <layout> - <window_info content_ui="combo" id="Project" order="0" weight="0.26367614" /> + <window_info content_ui="combo" id="Project" order="0" weight="0.13219616" /> <window_info id="Structure" order="1" side_tool="true" weight="0.25" /> <window_info id="Favorites" order="2" side_tool="true" /> <window_info anchor="bottom" id="Version Control" order="0" weight="0.32936078" /> @@ -362,80 +304,148 @@ <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" x="11" y="368" width="1898" height="304" id="Run" order="3" weight="0.68443495" /> - <window_info anchor="right" id="Run Dashboard" order="4" weight="0.50875276" /> + <window_info active="true" anchor="right" id="Run Dashboard" order="4" visible="true" weight="0.5079957" /> </layout> </component> + <component name="XDebuggerManager"> + <breakpoint-manager> + <breakpoints> + <line-breakpoint enabled="true" suspend="THREAD" type="python-line"> + <url>file://$PROJECT_DIR$/Beginner training/Exam 2.py</url> + <option name="timeStamp" value="4" /> + </line-breakpoint> + <line-breakpoint enabled="true" suspend="THREAD" type="python-line"> + <url>file://$PROJECT_DIR$/Beginner training/Classes.py</url> + <line>218</line> + <option name="timeStamp" value="14" /> + </line-breakpoint> + </breakpoints> + </breakpoint-manager> + </component> <component name="editorHistoryManager"> <entry file="file://$PROJECT_DIR$/Beginner training/005 UniqueCombinations.py" /> - <entry file="file://$PROJECT_DIR$/Beginner training/Basic synthax.py"> + <entry file="file://$PROJECT_DIR$/Beginner training/002 Pets.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="34"> - <caret line="4" selection-start-line="4" selection-end-line="4" selection-end-column="33" /> + <state relative-caret-position="68"> + <caret line="4" selection-start-line="4" selection-end-line="4" /> + <folding> + <element signature="e#0#10#0" expanded="true" /> + </folding> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/Beginner training/001 GoSkiing.py"> + <entry file="file://$PROJECT_DIR$/Beginner training/003 Hotel.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="136"> - <caret line="9" column="29" selection-start-line="9" selection-start-column="29" selection-end-line="9" selection-end-column="29" /> + <state relative-caret-position="68"> + <caret line="4" selection-start-line="4" selection-end-line="4" /> + <folding> + <element signature="e#0#10#0" expanded="true" /> + </folding> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/Beginner training/004 TakingCare.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="204"> - <caret line="14" column="45" selection-start-line="14" selection-start-column="45" selection-end-line="14" selection-end-column="45" /> + <state relative-caret-position="68"> + <caret line="4" selection-start-line="4" selection-end-line="4" /> <folding> <element signature="e#0#10#0" expanded="true" /> </folding> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/Beginner training/Random.py"> + <entry file="file://$PROJECT_DIR$/Beginner training/001 GoSkiing.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="85"> - <caret line="5" selection-start-line="5" selection-end-line="5" /> + <state relative-caret-position="51"> + <caret line="3" selection-start-line="3" selection-end-line="3" /> <folding> <element signature="e#0#10#0" expanded="true" /> - <element signature="e#48#56#1" /> - <element signature="e#190#698#1" /> - <element signature="e#700#1063#1" /> - <element signature="e#1065#1230#1" /> </folding> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/Beginner training/003 Hotel.py"> + <entry file="file://$PROJECT_DIR$/Beginner training/Exam 1.py"> <provider selected="true" editor-type-id="text-editor"> - <state> - <caret selection-end-line="2" selection-end-column="11" /> + <state relative-caret-position="221"> + <caret line="77" column="12" selection-start-line="77" selection-start-column="12" selection-end-line="77" selection-end-column="12" /> <folding> - <element signature="e#0#10#0" expanded="true" /> + <element signature="e#68#589#0" /> + <element signature="e#607#1325#0" /> + <element signature="e#1344#2025#0" /> + <element signature="e#2054#2518#0" /> </folding> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/Beginner training/002 Pets.py"> + <entry file="file://$PROJECT_DIR$/Beginner training/011 FitnessEquipment.py"> <provider selected="true" editor-type-id="text-editor"> - <state> - <caret selection-end-line="2" selection-end-column="11" /> + <state relative-caret-position="34"> + <caret line="5" selection-start-line="5" selection-end-line="5" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/Beginner training/012 FitnessVisitors.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="34"> + <caret line="5" selection-start-line="5" selection-end-line="5" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/Beginner training/Random.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="306"> + <caret line="18" selection-start-line="18" selection-end-line="18" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/Beginner training/Basic synthax.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="34"> + <caret line="4" column="19" lean-forward="true" selection-start-line="4" selection-start-column="19" selection-end-line="4" selection-end-column="19" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/Beginner training/Tasks.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="170"> + <caret line="67" column="8" lean-forward="true" selection-start-line="67" selection-start-column="8" selection-end-line="67" selection-end-column="8" /> <folding> - <element signature="e#0#10#0" expanded="true" /> + <element signature="e#66#461#0" /> + <element signature="e#488#1093#0" /> + <element signature="e#1136#1525#0" /> + <element signature="e#1560#1717#0" /> </folding> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/Beginner training/011 FitnessEquipment.py"> + <entry file="file://$PROJECT_DIR$/Beginner training/Exam 2.py"> <provider selected="true" editor-type-id="text-editor"> - <state> - <caret line="3" column="9" lean-forward="true" selection-end-line="3" selection-end-column="9" /> + <state relative-caret-position="119"> + <caret line="47" column="1" selection-start-line="47" selection-start-column="1" selection-end-line="47" selection-end-column="1" /> + <folding> + <element signature="e#76#469#0" /> + <element signature="e#562#1217#0" /> + </folding> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/Beginner training/012 FitnessVisitors.py"> + <entry file="file://$PROJECT_DIR$/Beginner training/Classes.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="374"> - <caret line="25" lean-forward="true" selection-start-line="25" selection-end-line="25" /> + <state relative-caret-position="170"> + <caret line="234" selection-start-line="234" selection-end-line="234" /> + <folding> + <element signature="e#76#1213#0" /> + <element signature="e#1250#4841#0" /> + <element signature="e#1267#1805#0" /> + <element signature="e#2294#3190#0" /> + <element signature="e#3266#4029#0" /> + <element signature="e#3606#3689#0" /> + <element signature="e#3745#3772#0" /> + <element signature="e#3870#3894#0" /> + <element signature="e#2353#2464#0" /> + <element signature="e#5490#7384#0" /> + <element signature="e#5529#5887#0" /> + </folding> </state> </provider> </entry> diff --git a/Python/Beginner training/001 GoSkiing.py b/Python/Beginner training/001 GoSkiing.py deleted file mode 100644 index 28f6f33..0000000 --- a/Python/Beginner training/001 GoSkiing.py +++ /dev/null @@ -1,12 +0,0 @@ -import sys -import os - -skier_n = int(input('Type number of skiers: ')) -jacket_n_per_person = int(input('Type number of jackets per person: ')) -helmet_n_per_person = int(input('Type number of helmets per person: ')) -shoe_set_n_per_person = int(input('Type number of shoes per person: ')) - -total_per_person = (jacket_n_per_person * 120) + (helmet_n_per_person * 75) + (shoe_set_n_per_person * 299.9) -total_price = total_per_person * skier_n - -print('Total price for all skiers: ', round(total_price + total_price * 0.2, 2))
\ No newline at end of file diff --git a/Python/Beginner training/002 Pets.py b/Python/Beginner training/002 Pets.py deleted file mode 100644 index bdc5a3b..0000000 --- a/Python/Beginner training/002 Pets.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import os -import math - -days_absent = int(input('Type the number of days that you wil be absent: ')) -left_food_kg = float(input('Type the number of left food in kg: ')) -daily_consumption_first = float(input('Type the daily consumption of the first cat in kg: ')) -daily_consumption_second = float(input('Type the daily consumption of the second cat in kg: ')) - -left_food_kg -= days_absent * daily_consumption_first -left_food_kg -= days_absent * daily_consumption_second - -if left_food_kg >= 0: - print('The cats are well fed') - print('{} kilos of food left'.format(left_food_kg)) -else: - print('The cats are hungry') - print('{} more kilos of food are needed'.format(int(abs(left_food_kg))))
\ No newline at end of file diff --git a/Python/Beginner training/003 Hotel.py b/Python/Beginner training/003 Hotel.py deleted file mode 100644 index 0e2ed2a..0000000 --- a/Python/Beginner training/003 Hotel.py +++ /dev/null @@ -1,31 +0,0 @@ -import sys -import os -import math - -n_nights = int(input('Type number of nights: ')) -room_type = input('Type the type of room: ') - -price = 0.0 -if room_type == 'apartment': - price = n_nights * 70 -else: - price = n_nights * 125 - -#code doesn't account for writing mistakes -if n_nights < 10: - if room_type == 'apartment': - price *= 0.7 - else: - price *= 0.9 -elif n_nights > 15: - if room_type == 'apartment': - price *= 0.5 - else: - price *= 0.8 -else: - if room_type == 'apartment': - price *= 0.65 - else: - price *= 0.85 - -print('Total price: {}'.format(round(price, 2)))
\ No newline at end of file diff --git a/Python/Beginner training/004 TakingCare.py b/Python/Beginner training/004 TakingCare.py deleted file mode 100644 index 47143a3..0000000 --- a/Python/Beginner training/004 TakingCare.py +++ /dev/null @@ -1,15 +0,0 @@ -import sys -import os -import math - -food = int(input('Type bought amount of food in kg: ')) * 1000 -days_care = int(input('Type days the the animals wil be taken care of: ')) - -for i in range(days_care): - daily_consumption = int(input('Food that the animal has eaten that day: ')) - food -= daily_consumption - -if food >= 0: - print('Food is enough! Leftovers: {} grams'.format(food)) -else: - print('Food is not enough. You need {} grams more'.format(abs(food)))
\ No newline at end of file diff --git a/Python/Beginner training/011 FitnessEquipment.py b/Python/Beginner training/011 FitnessEquipment.py deleted file mode 100644 index a8046da..0000000 --- a/Python/Beginner training/011 FitnessEquipment.py +++ /dev/null @@ -1,16 +0,0 @@ -import sys -import math -import random -import os - -total_sum = 0.0 -for x in range(int(input())): - item_name = input() - - if item_name == "treadmill": total_sum += 5899 - elif item_name == "cross trainer": total_sum += 1699 - elif item_name == "exercise bike": total_sum += 1789 - elif item_name == "dumbells": total_sum += 579 - else: print("ERROR, Invalid product name") - -print(round(total_sum, 2))
\ No newline at end of file diff --git a/Python/Beginner training/012 FitnessVisitors.py b/Python/Beginner training/012 FitnessVisitors.py deleted file mode 100644 index 382c145..0000000 --- a/Python/Beginner training/012 FitnessVisitors.py +++ /dev/null @@ -1,25 +0,0 @@ -import sys -import math -import random -import os - -names = list(input("Type names: ").split(", ")) - -while True: - command = input() - if command == "END": break - - if command == "Add visitor": - names.append(input()) - elif command == "Add visitor on position": - name_to_insert = input() - names.insert(int(input()), name_to_insert) - elif command == "Remove visitor on position": - names.pop(int(input())) - elif command == "Remove last visitor": - names.pop(len(names) - 1) - elif command == "Remove first visitor": - names.pop(0) - else: print("ERROR, indxistant command") - -print(names) diff --git a/Python/Beginner training/Classes.py b/Python/Beginner training/Classes.py new file mode 100644 index 0000000..ea537f8 --- /dev/null +++ b/Python/Beginner training/Classes.py @@ -0,0 +1,238 @@ +import sys +import math +import random +import os + +def BankAccountTask(): + class BankAccount: + def __init__(self, id, balance): + self.id = int(id) + self.__balance = float(balance) + + def Deposit(self, amount): + self.__balance += amount + + def Withdraw(self, amount): + self.__balance -= amount + + def GetBalance(self): + return self.__balance + + def __str__(self): + return "Account {0}, balance {1}".format(self.id, self.GetBalance()) + + accounts = {} + while True: + command = input().split(' ') + + if command[0].lower() == "end": + break + elif command[0] == "Add": + accounts[int(command[1])] = BankAccount(int(command[1]), float(command[2])) + elif command[0] == "Deposit": + accounts[int(command[1])].Deposit(float(command[2])) + elif command[0] == "Withdraw": + accounts[int(command[1])].Withdraw(float(command[2])) + elif command[0] == "Info": + print(accounts[int(command[1])]) + elif command[0] == "Print": + for acc in accounts: print(accounts[acc]) + else: + print("Invalid command!") + + +def PizzaTask(): + class Dough(): + def __init__(self, type, cooking_method, weight): + type = type.lower(); cooking_method = cooking_method.lower() + self.__validate(type, cooking_method, weight) + + self.__type = str(type) + self.__cooking_method = str(cooking_method) + self.__weight = int(weight) + + self.__total_cals = 2.0 * self.__weight + if type == "white": self.__total_cals *= 1.5 + if cooking_method == "crispy": + self.__total_cals *= 0.9 + elif cooking_method == "chewy": + self.__total_cals *= 1.1 + + def __validate(self, type, cooking_method, weight): + type = str(type); cooking_method = str(cooking_method); weight = int(weight) + + if (type != "white" and type != "wholegrain") or \ + (cooking_method != "crispy" and cooking_method != "chewy" and cooking_method != "homemade"): + raise ValueError() + + if weight < 1 or weight > 200: + raise NameError() + + def get_cals(self): + return self.__total_cals + + class Topping(): + def __init__(self, type, weight): + type = type.lower() + self.__validate(type, weight) + + self.__type = str(type) + self.__weight = int(weight) + + self.__total_cals = 2.0 * self.__weight + if type == "veggies": + self.__total_cals *= 0.8 + elif type == "sauce": + self.__total_cals *= 0.9 + elif type == "cheese": + self.__total_cals *= 1.1 + else: + self.__total_cals *= 1.2 # Sauce + + def __validate(self, type, weight): + type = str(type); weight = int(weight) + + # usng different types of error to indicate what to write on screen + if type != "meat" and type != "veggies" and type != "cheese" and type != "sauce": + raise AssertionError() + + if weight < 1 or weight > 50: + raise AttributeError() + + def get_cals(self): + return self.__total_cals + + class Pizza(): + def __init__(self, name, num): + self.__validate(name, num) + + self.name = str(name) + self.__dough = None # not public because task doesn't want it to be + self.__toppings = [] + self.__total_cals = 0.0 + + def __validate(self, name, num): + name = str(name); num = int(num) + + if len(name) < 1 or len(name) > 15: + raise MemoryError() + + if num < 0 or num > 10: + raise IndexError() + + def add_dough(self, dough): + self.__dough = dough + self.__total_cals += dough.get_cals() + + def add_topping(self, topping): + self.__toppings.append(topping) + self.__total_cals += topping.get_cals() + + def __str__(self): + return "{0} - {1} Calories.".format(self.name, self.__total_cals) + + def n_toppings(self): + return len(self.__toppings) + + def cals(self): + return self.__total_cals + + info = input().split(' ') + try: + in_pizza = Pizza(info[1], info[2]) + + info = input().split(' ') + in_pizza.add_dough(Dough(info[1], info[2], info[3])) + + while True: + info = input().split(' ') + + if info[0].lower() == "end": + break + else: + in_pizza.add_topping(Topping(info[1], info[2])) + + print(in_pizza) + + except ValueError: + print('Invalid type of dough.') + except NameError: + print('Dough weight should be in the range [1..200].') + except AssertionError: + print('Cannot place {0} on top of your pizza.'.format(info[1])) + except AttributeError: + print('{0} weight should be in the range [1..50].'.format(info[1])) + except MemoryError: + print('Pizza name should be between 1 and 15 symbols.') + except IndexError: + print('Number of toppings should be in range [0..10].') + + while True: + command = input().split(' ') + + if command[0] == "END": break + # elif command[0] == "Dough": + + +def CarVender(): + class Engine(): + def __init__(self, model, power, displacement = 'n/a', efficiency = 'n/a'): + self.__model = model + self.__power = power + self.displacement = displacement + self.efficiency = efficiency + + def __str__(self): + return " {0}:\n Power: {1}\n Displacement: {2}\n Efficiency: {3}"\ + .format(self.__model, self.__power, self.displacement, self.efficiency) + + class Car(): + def __init__(self, model, engine, weight = 'n/a', color = 'n/a'): + self.__model = model + self.__engine = engine + self.weight = weight + self.color = color + + def __str__(self): + return "{0}:\n{1}\n Weight: {2}\n Color: {3}"\ + .format(self.__model, self.__engine, self.weight, self.color) + + engines = {} + engines_n = int(input()) + for i in range(engines_n): + info = input().split(' ') + list(filter(lambda e: e != ' ', info)) + + engines[info[0]] = (Engine(info[0], info[1])) + if len(info) == 3: + try: + engines[info[0]].displacement = int(info[2]) + except: + engines[info[0]].efficiency = info[2] + elif len(info) == 4: + engines[info[0]].displacement = int(info[2]) + engines[info[0]].efficiency = info[3] + + cars = [] + cars_n = int(input()) + for i in range(cars_n): + info = input().split(' ') + info = [e for e in info if e != ''] + + cars.append(Car(info[0], engines[info[1]])) + if len(info) == 3: + try: + cars[i].weight = int(info[2]) + except: + cars[i].color = info[2] + elif len(info) == 4: + cars[i].weight = info[2] + cars[i].color = info[3] + + for curr_car in cars: + print(curr_car) + + +#BankAccountTask() +#PizzaTask() +CarVender() diff --git a/Python/Beginner training/Exam 1.py b/Python/Beginner training/Exam 1.py new file mode 100644 index 0000000..6e04541 --- /dev/null +++ b/Python/Beginner training/Exam 1.py @@ -0,0 +1,78 @@ +import sys +import math +import random +import os + +def GoSkiing(): + skier_n = int(input('Type number of skiers: ')) + jacket_n_per_person = int(input('Type number of jackets per person: ')) + helmet_n_per_person = int(input('Type number of helmets per person: ')) + shoe_set_n_per_person = int(input('Type number of shoes per person: ')) + + total_per_person = (jacket_n_per_person * 120) + (helmet_n_per_person * 75) + (shoe_set_n_per_person * 299.9) + total_price = total_per_person * skier_n + + print('Total price for all skiers: ', round(total_price + total_price * 0.2, 2)) + +def Pets(): + days_absent = int(input('Type the number of days that you wil be absent: ')) + left_food_kg = float(input('Type the number of left food in kg: ')) + daily_consumption_first = float(input('Type the daily consumption of the first cat in kg: ')) + daily_consumption_second = float(input('Type the daily consumption of the second cat in kg: ')) + + left_food_kg -= days_absent * daily_consumption_first + left_food_kg -= days_absent * daily_consumption_second + + if left_food_kg >= 0: + print('The cats are well fed') + print('{} kilos of food left'.format(left_food_kg)) + else: + print('The cats are hungry') + print('{} more kilos of food are needed'.format(int(abs(left_food_kg)))) + +def Hotel(): + n_nights = int(input('Type number of nights: ')) + room_type = input('Type the type of room: ') + + price = 0.0 + if room_type == 'apartment': + price = n_nights * 70 + else: + price = n_nights * 125 + + # code doesn't account for writing mistakes + if n_nights < 10: + if room_type == 'apartment': + price *= 0.7 + else: + price *= 0.9 + elif n_nights > 15: + if room_type == 'apartment': + price *= 0.5 + else: + price *= 0.8 + else: + if room_type == 'apartment': + price *= 0.65 + else: + price *= 0.85 + + print('Total price: {}'.format(round(price, 2))) + +def TakingCare(): + food = int(input('Type bought amount of food in kg: ')) * 1000 + days_care = int(input('Type days the the animals wil be taken care of: ')) + + for i in range(days_care): + daily_consumption = int(input('Food that the animal has eaten that day: ')) + food -= daily_consumption + + if food >= 0: + print('Food is enough! Leftovers: {} grams'.format(food)) + else: + print('Food is not enough. You need {} grams more'.format(abs(food))) + +GoSkiing() +Pets() +Hotel() +TakingCare()
\ No newline at end of file diff --git a/Python/Beginner training/Exam 2.py b/Python/Beginner training/Exam 2.py new file mode 100644 index 0000000..c3d20bd --- /dev/null +++ b/Python/Beginner training/Exam 2.py @@ -0,0 +1,48 @@ +import sys +import math +import random +import os + +def FitnessEquipment(): + total_sum = 0.0 + for x in range(int(input())): + item_name = input() + + if item_name == "treadmill": + total_sum += 5899 + elif item_name == "cross trainer": + total_sum += 1699 + elif item_name == "exercise bike": + total_sum += 1789 + elif item_name == "dumbells": + total_sum += 579 + else: + print("ERROR, Invalid product name") + + print(round(total_sum, 2)) + +def FitnessVisitors(): + names = list(input("Type names: ").split(", ")) + + while True: + command = input() + if command == "END": break + + if command == "Add visitor": + names.append(input()) + elif command == "Add visitor on position": + name_to_insert = input() + names.insert(int(input()), name_to_insert) + elif command == "Remove visitor on position": + names.pop(int(input())) + elif command == "Remove last visitor": + names.pop(len(names) - 1) + elif command == "Remove first visitor": + names.pop(0) + else: + print("ERROR, indxistant command") + + print(names) + +FitnessEquipment() +FitnessVisitors()
\ No newline at end of file diff --git a/Python/Beginner training/Random.py b/Python/Beginner training/Random.py deleted file mode 100644 index d913a72..0000000 --- a/Python/Beginner training/Random.py +++ /dev/null @@ -1,67 +0,0 @@ -import sys -import os -import random -import math - - - -''' Divide -cycle_n = int(input("Type number of numbers that will be typed: ")) -p1 = 0; p2 = 0; p3 = 0 - -for x in range(cycle_n): - num = int(input()) - - if num % 2 == 0: p1 += 1 - if num % 3 == 0: p2 += 1 - if num % 4 == 0: p3 += 1 - -print(round(p1 * 100 / cycle_n, 2), "%") -print(round(p2 * 100 / cycle_n, 2), "%") -print(round(p3 * 100 / cycle_n, 2), "%") - -''' - -''' Histogram -cycle_n = int(input("Type number of numbers that will be typed: ")) -p1 = 0; p2 = 0; p3 = 0; p4 = 0; p5 = 0 - -for x in range(cycle_n): - num = int(input()) - - if num < 200: p1 += 1 - elif num < 400: p2 += 1 - elif num < 600: p3 += 1 - elif num < 800: p4 += 1 - else: p5 += 1 - -print(round(p1 * 100 / cycle_n, 2), "%") -print(round(p2 * 100 / cycle_n, 2), "%") -print(round(p3 * 100 / cycle_n, 2), "%") -print(round(p4 * 100 / cycle_n, 2), "%") -print(round(p5 * 100 / cycle_n, 2), "%") -''' - -''' Number matrix -size = int(input("Type size of matrix: ")) - -for x in range(size): - for y in range(size): - num = y + x + 1 - - if num <= size or x == 0: - print(end="{} ".format(num)) #doing it like this for practice - else: - print(end="{} ".format(2 * size - num)) #doing it like this for practice - else: print() -''' - -''' Factoriel code: -factoriel_n = int(input("Type times of factoriel: ")) - -final_int = 1 -for x in range(1, factoriel_n + 1): - final_int *= x - -print(final_int) -'''
\ No newline at end of file diff --git a/Python/Beginner training/Tasks.py b/Python/Beginner training/Tasks.py new file mode 100644 index 0000000..873bde6 --- /dev/null +++ b/Python/Beginner training/Tasks.py @@ -0,0 +1,71 @@ +import sys +import os +import random +import math + +def Divide(): + cycle_n = int(input("Type number of numbers that will be typed: ")) + p1 = 0; p2 = 0; p3 = 0 + + for x in range(cycle_n): + num = int(input()) + + if num % 2 == 0: p1 += 1 + if num % 3 == 0: p2 += 1 + if num % 4 == 0: p3 += 1 + + print(round(p1 * 100 / cycle_n, 2), "%") + 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 + + for x in range(cycle_n): + num = int(input()) + + if num < 200: + p1 += 1 + elif num < 400: + p2 += 1 + elif num < 600: + p3 += 1 + elif num < 800: + p4 += 1 + else: + p5 += 1 + + print(round(p1 * 100 / cycle_n, 2), "%") + print(round(p2 * 100 / cycle_n, 2), "%") + print(round(p3 * 100 / cycle_n, 2), "%") + print(round(p4 * 100 / cycle_n, 2), "%") + print(round(p5 * 100 / cycle_n, 2), "%") + +def NumberMatrix(): + size = int(input("Type size of matrix: ")) + + for x in range(size): + for y in range(size): + num = y + x + 1 + + if num <= size or x == 0: + print(end="{} ".format(num)) # doing it like this for practice + else: + print(end="{} ".format(2 * size - num)) # doing it like this for practice + else: + print() + +def Factoriel(): + factoriel_n = int(input("Type times of factoriel: ")) + + final_int = 1 + for x in range(1, factoriel_n + 1): + final_int *= x + + print(final_int) + +Divide() +Histogram() +NumberMatrix() +Factoriel()
\ No newline at end of file |
