9th day of python challenges 124-145

This commit is contained in:
abd.shallal 2019-08-05 16:33:21 +03:00
parent 5349baf68b
commit 81d4fd37bf
4 changed files with 101 additions and 204 deletions

View File

@ -72,6 +72,10 @@
<option value="E501" />
<option value="W29" />
<option value="E501" />
<option value="W29" />
<option value="E501" />
<option value="W29" />
<option value="E501" />
</list>
</option>
</inspection_tool>

View File

@ -2,12 +2,8 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="7106b959-52c5-4d26-9f5a-8703a78c8c29" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/challenges118-123/challenge-118.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/challenges118-123/challenge-119.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/challenges118-123/challenge-120.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/challenges118-123/challenge-121.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/challenges118-123/challenge-122.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/challenges118-123/challenge-123.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/challenges139-145/challenge-139.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
@ -18,75 +14,21 @@
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<leaf>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/challenges111-117/challenge-116.py">
<entry file="file://$PROJECT_DIR$/commands">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="440">
<caret line="35" selection-start-line="35" selection-end-line="39" selection-end-column="18" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/challenges118-123/challenge-118.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="10" selection-start-line="10" selection-end-line="10" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/challenges118-123/challenge-119.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="540">
<caret line="36" lean-forward="true" selection-start-line="36" selection-end-line="36" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/challenges118-123/challenge-120.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="31" column="4" selection-start-line="31" selection-start-column="4" selection-end-line="31" selection-end-column="24" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/challenges118-123/challenge-121.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="28" selection-start-line="28" selection-end-line="46" selection-end-column="53" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/challenges118-123/challenge-122.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="525">
<caret line="35" column="15" selection-end-line="39" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/challenges118-123/challenge-123.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="510">
<caret line="34" column="73" selection-start-line="34" selection-start-column="73" selection-end-line="34" selection-end-column="73" />
<state relative-caret-position="30">
<caret line="2" selection-start-line="2" selection-end-line="2" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/challenges118-123/Salaries.csv">
<entry file="file://$PROJECT_DIR$/challenges139-145/challenge-139.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" lean-forward="true" selection-start-line="2" selection-end-line="2" />
<state relative-caret-position="180">
<caret line="12" selection-start-line="12" selection-end-line="12" />
</state>
</provider>
</entry>
@ -114,16 +56,9 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/challenges111-117/Books.csv" />
<option value="$PROJECT_DIR$/challenges111-117/challenge-116.py" />
<option value="$PROJECT_DIR$/challenges111-117/challenge-117.py" />
<option value="$PROJECT_DIR$/challenges118-123/challenge-118.py" />
<option value="$PROJECT_DIR$/challenges118-123/challenge-119.py" />
<option value="$PROJECT_DIR$/challenges118-123/challenge-120.py" />
<option value="$PROJECT_DIR$/challenges118-123/challenge-121.py" />
<option value="$PROJECT_DIR$/challenges118-123/challenge-122.py" />
<option value="$PROJECT_DIR$/challenges118-123/challenge-123.py" />
<option value="$PROJECT_DIR$/challenges118-123/Salaries.csv" />
<option value="$PROJECT_DIR$/challenges124-132/challenge-124.py" />
<option value="$PROJECT_DIR$/commands" />
<option value="$PROJECT_DIR$/challenges139-145/challenge-139.py" />
</list>
</option>
</component>
@ -147,16 +82,6 @@
<item name="paython-by-learn" type="b2602c69:ProjectViewProjectNode" />
<item name="paython-by-learn" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="paython-by-learn" type="b2602c69:ProjectViewProjectNode" />
<item name="paython-by-learn" type="462c0819:PsiDirectoryNode" />
<item name="challenges111-117" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="paython-by-learn" type="b2602c69:ProjectViewProjectNode" />
<item name="paython-by-learn" type="462c0819:PsiDirectoryNode" />
<item name="challenges118-123" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
@ -200,7 +125,7 @@
</list>
</option>
</component>
<component name="RunManager" selected="Python.challenge-123">
<component name="RunManager" selected="Python.challenge-139">
<configuration default="true" type="PythonConfigurationType" factoryName="Python">
<module name="paython-by-learn" />
<option name="INTERPRETER_OPTIONS" value="" />
@ -223,48 +148,13 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="challenge-119" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="paython-by-learn" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/challenges118-123" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/challenges118-123/challenge-119.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="true" />
<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="challenge-120" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="paython-by-learn" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/challenges118-123" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/challenges118-123/challenge-120.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="true" />
<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="challenge-121" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="paython-by-learn" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/challenges118-123" />
<option name="IS_MODULE_SDK" value="true" />
@ -284,6 +174,9 @@
<module name="paython-by-learn" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/challenges118-123" />
<option name="IS_MODULE_SDK" value="true" />
@ -303,6 +196,9 @@
<module name="paython-by-learn" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/challenges118-123" />
<option name="IS_MODULE_SDK" value="true" />
@ -318,13 +214,51 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="challenge-124" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="paython-by-learn" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/challenges124-132" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/challenges124-132/challenge-124.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="true" />
<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="challenge-139" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="paython-by-learn" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/challenges139-145" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/challenges139-145/challenge-139.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="true" />
<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>
<recent_temporary>
<list>
<item itemvalue="Python.challenge-139" />
<item itemvalue="Python.challenge-124" />
<item itemvalue="Python.challenge-123" />
<item itemvalue="Python.challenge-122" />
<item itemvalue="Python.challenge-121" />
<item itemvalue="Python.challenge-120" />
<item itemvalue="Python.challenge-119" />
</list>
</recent_temporary>
</component>
@ -342,6 +276,8 @@
<workItem from="1564909882780" duration="227000" />
<workItem from="1564910149868" duration="6468000" />
<workItem from="1564917264092" duration="216000" />
<workItem from="1565005915966" duration="256000" />
<workItem from="1565006355001" duration="371000" />
</task>
<servers />
</component>
@ -349,8 +285,13 @@
<frame x="-1" y="-4" width="1922" height="1085" extended-state="6" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24301529" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.24986821" />
<window_info id="Structure" order="1" weight="0.25" />
<window_info anchor="bottom" id="Educational.CheckDetails" />
<window_info anchor="bottom" id="Version Control" />
<window_info anchor="bottom" id="Terminal" weight="0.3294979" />
<window_info anchor="bottom" id="Event Log" side_tool="true" />
<window_info anchor="bottom" id="Python Console" visible="true" weight="0.3294979" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" />
@ -358,11 +299,6 @@
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Version Control" order="7" />
<window_info anchor="bottom" id="Educational.CheckDetails" order="8" />
<window_info anchor="bottom" id="Terminal" order="9" />
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
<window_info anchor="bottom" id="Python Console" order="11" visible="true" weight="0.31276152" />
<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" />
@ -417,85 +353,27 @@
<MESSAGE value="8th day of python challenges 105-110" />
<MESSAGE value="8th day of python challenges 111" />
<MESSAGE value="8th day of python challenges 111-117" />
<option name="LAST_COMMIT_MESSAGE" value="8th day of python challenges 111-117" />
<MESSAGE value="9th day of python challenges 118-123" />
<option name="LAST_COMMIT_MESSAGE" value="9th day of python challenges 118-123" />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/paython_by_learn$challenge_039.coverage" NAME="challenge-039 Coverage Results" MODIFIED="1563282890417" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/challenges35-44" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/challenges111-117/Books.csv">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="5" column="36" selection-start-line="5" selection-start-column="36" selection-end-line="5" selection-end-column="36" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/challenges111-117/QuizScore.csv">
<entry file="file://$PROJECT_DIR$/challenges124-132/challenge-124.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/challenges118-123/challenge-119.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="540">
<caret line="36" lean-forward="true" selection-start-line="36" selection-end-line="36" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/challenges111-117/challenge-117.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="6" selection-start-line="6" selection-end-line="9" selection-end-column="83" />
<folding>
<element signature="e#0#10#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/challenges118-123/challenge-118.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="10" selection-start-line="10" selection-end-line="10" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/challenges118-123/challenge-120.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="31" column="4" selection-start-line="31" selection-start-column="4" selection-end-line="31" selection-end-column="24" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/challenges118-123/challenge-121.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="28" selection-start-line="28" selection-end-line="46" selection-end-column="53" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/challenges118-123/challenge-122.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="525">
<caret line="35" column="15" selection-end-line="39" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/challenges111-117/challenge-116.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="440">
<caret line="35" selection-start-line="35" selection-end-line="39" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/challenges118-123/challenge-123.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="510">
<caret line="34" column="73" selection-start-line="34" selection-start-column="73" selection-end-line="34" selection-end-column="73" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/challenges118-123/Salaries.csv">
<entry file="file://$PROJECT_DIR$/commands">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" lean-forward="true" selection-start-line="2" selection-end-line="2" />
<caret line="2" selection-start-line="2" selection-end-line="2" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/challenges139-145/challenge-139.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="12" selection-start-line="12" selection-end-line="12" />
</state>
</provider>
</entry>

View File

@ -0,0 +1,12 @@
import sqlite3
with sqlite3.connect('python-by-example') as db:
cursor = db.cursor()
cursor.execute("""CREATE TABLE IF NOT EXISTS employees(
id integer PRIMARY KEY,
name text NOT NULL,
dept text NOT NULL,
salary integer);""")
cursor.execute("""INSERT INTO employees(id,name,dept,salary)
VALUES("1","Bob","Sales","25000")""")
db.commit()

3
commands Normal file
View File

@ -0,0 +1,3 @@
sudo apt-get install python3-tk
sudo apt install sqlite