Created
January 11, 2020 15:07
-
-
Save flfelipelopes/c0a777c20fd1afcff7b7d50a0fae7adf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="InspectionProjectProfileManager"> | |
<settings> | |
<option name="USE_PROJECT_PROFILE" value="false" /> | |
<version value="1.0" /> | |
</settings> | |
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (venv)" project-jdk-type="Python SDK" /> | |
<component name="PythonCompatibilityInspectionAdvertiser"> | |
<option name="version" value="3" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/.idea/Python Exercises.iml" filepath="$PROJECT_DIR$/.idea/Python Exercises.iml" /> | |
</modules> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="PYTHON_MODULE" version="4"> | |
<component name="NewModuleRootManager"> | |
<content url="file://$MODULE_DIR$" /> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
<component name="TestRunnerService"> | |
<option name="PROJECT_TEST_RUNNER" value="Unittests" /> | |
</component> | |
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ChangeListManager"> | |
<list default="true" id="76b6a88b-23ce-48c0-bdf4-7e086a9e1e30" name="Default Changelist" comment="" /> | |
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> | |
<option name="SHOW_DIALOG" value="false" /> | |
<option name="HIGHLIGHT_CONFLICTS" value="true" /> | |
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> | |
<option name="LAST_RESOLUTION" value="IGNORE" /> | |
</component> | |
<component name="FileTemplateManagerImpl"> | |
<option name="RECENT_TEMPLATES"> | |
<list> | |
<option value="Python Script" /> | |
</list> | |
</option> | |
</component> | |
<component name="ProjectId" id="1U2dg0jgngMNdOebUcDiMYeTYKp" /> | |
<component name="PropertiesComponent"> | |
<property name="last_opened_file_path" value="$USER_HOME$/Desktop/Cursoemvideo/PythonExercicios" /> | |
<property name="settings.editor.selected.configurable" value="terminal" /> | |
</component> | |
<component name="PyConsoleOptionsProvider"> | |
<option name="myUseExistingConsole" value="true" /> | |
</component> | |
<component name="RunDashboard"> | |
<option name="ruleStates"> | |
<list> | |
<RuleState> | |
<option name="name" value="ConfigurationTypeDashboardGroupingRule" /> | |
</RuleState> | |
<RuleState> | |
<option name="name" value="StatusDashboardGroupingRule" /> | |
</RuleState> | |
</list> | |
</option> | |
</component> | |
<component name="RunManager" selected="Python.test3"> | |
<configuration name="3.8.0" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true"> | |
<module name="Python Exercises" /> | |
<option name="INTERPRETER_OPTIONS" value="" /> | |
<option name="PARENT_ENVS" value="true" /> | |
<envs> | |
<env name="PYTHONUNBUFFERED" value="1" /> | |
</envs> | |
<option name="SDK_HOME" value="C:\Users\flfel\venv\Scripts\python.exe" /> | |
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../../../Programação/Python" /> | |
<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$/../../../Programação/Python/3.8.0" /> | |
<option name="PARAMETERS" value="" /> | |
<option name="SHOW_COMMAND_LINE" value="false" /> | |
<option name="EMULATE_TERMINAL" value="true" /> | |
<option name="MODULE_MODE" value="false" /> | |
<option name="REDIRECT_INPUT" value="false" /> | |
<option name="INPUT_FILE" value="" /> | |
<method v="2" /> | |
</configuration> | |
<configuration name="6.2" type="PythonConfigurationType" factoryName="Python" temporary="true"> | |
<module name="Python Exercises" /> | |
<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$" /> | |
<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="$PROJECT_DIR$/6.2.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="6.4" type="PythonConfigurationType" factoryName="Python" temporary="true"> | |
<module name="Python Exercises" /> | |
<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$" /> | |
<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="$PROJECT_DIR$/6.4.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="hypotenuse" type="PythonConfigurationType" factoryName="Python" temporary="true"> | |
<module name="Python Exercises" /> | |
<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$" /> | |
<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="$PROJECT_DIR$/hypotenuse.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="learning_journal_unit3" type="PythonConfigurationType" factoryName="Python"> | |
<module name="Python Exercises" /> | |
<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$" /> | |
<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="$PROJECT_DIR$/learning_journal_unit3.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="my_code" type="PythonConfigurationType" factoryName="Python" temporary="true"> | |
<module name="Python Exercises" /> | |
<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$" /> | |
<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="$PROJECT_DIR$/my_code.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="test3" type="PythonConfigurationType" factoryName="Python" temporary="true"> | |
<module name="Python Exercises" /> | |
<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$" /> | |
<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="$PROJECT_DIR$/test3.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="tryme4" type="PythonConfigurationType" factoryName="Python"> | |
<module name="Python Exercises" /> | |
<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$" /> | |
<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="$PROJECT_DIR$/tryme4.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> | |
<list> | |
<item itemvalue="Python.tryme4" /> | |
<item itemvalue="Python.3.8.0" /> | |
<item itemvalue="Python.learning_journal_unit3" /> | |
<item itemvalue="Python.6.2" /> | |
<item itemvalue="Python.hypotenuse" /> | |
<item itemvalue="Python.6.4" /> | |
<item itemvalue="Python.my_code" /> | |
<item itemvalue="Python.test3" /> | |
</list> | |
<recent_temporary> | |
<list> | |
<item itemvalue="Python.test3" /> | |
<item itemvalue="Python.my_code" /> | |
<item itemvalue="Python.hypotenuse" /> | |
<item itemvalue="Python.6.2" /> | |
<item itemvalue="Python.6.4" /> | |
</list> | |
</recent_temporary> | |
</component> | |
<component name="SvnConfiguration"> | |
<configuration /> | |
</component> | |
<component name="TaskManager"> | |
<task active="true" id="Default" summary="Default task"> | |
<changelist id="76b6a88b-23ce-48c0-bdf4-7e086a9e1e30" name="Default Changelist" comment="" /> | |
<created>1574558731326</created> | |
<option name="number" value="Default" /> | |
<option name="presentableId" value="Default" /> | |
<updated>1574558731326</updated> | |
</task> | |
<servers /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ChangeListManager"> | |
<list default="true" id="76b6a88b-23ce-48c0-bdf4-7e086a9e1e30" name="Default Changelist" comment="" /> | |
<option name="SHOW_DIALOG" value="false" /> | |
<option name="HIGHLIGHT_CONFLICTS" value="true" /> | |
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> | |
<option name="LAST_RESOLUTION" value="IGNORE" /> | |
</component> | |
<component name="FileTemplateManagerImpl"> | |
<option name="RECENT_TEMPLATES"> | |
<list> | |
<option value="Python Script" /> | |
</list> | |
</option> | |
</component> | |
<component name="ProjectId" id="1U2dg0jgngMNdOebUcDiMYeTYKp" /> | |
<component name="ProjectViewState"> | |
<option name="hideEmptyMiddlePackages" value="true" /> | |
<option name="showExcludedFiles" value="true" /> | |
<option name="showLibraryContents" value="true" /> | |
</component> | |
<component name="PropertiesComponent"> | |
<property name="last_opened_file_path" value="$USER_HOME$/Desktop/Cursoemvideo/PythonExercicios" /> | |
<property name="settings.editor.selected.configurable" value="ics" /> | |
</component> | |
<component name="PyConsoleOptionsProvider"> | |
<option name="myUseExistingConsole" value="true" /> | |
</component> | |
<component name="RunManager" selected="Python.new_inverse_dict"> | |
<configuration name="3.8.0" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true"> | |
<module name="Python Exercises" /> | |
<option name="INTERPRETER_OPTIONS" value="" /> | |
<option name="PARENT_ENVS" value="true" /> | |
<envs> | |
<env name="PYTHONUNBUFFERED" value="1" /> | |
</envs> | |
<option name="SDK_HOME" value="C:\Users\flfel\venv\Scripts\python.exe" /> | |
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../../../Programação/Python" /> | |
<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$/../../../Programação/Python/3.8.0" /> | |
<option name="PARAMETERS" value="" /> | |
<option name="SHOW_COMMAND_LINE" value="false" /> | |
<option name="EMULATE_TERMINAL" value="true" /> | |
<option name="MODULE_MODE" value="false" /> | |
<option name="REDIRECT_INPUT" value="false" /> | |
<option name="INPUT_FILE" value="" /> | |
<method v="2" /> | |
</configuration> | |
<configuration name="discussion_assignment_8" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> | |
<module name="Python Exercises" /> | |
<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$" /> | |
<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="$PROJECT_DIR$/discussion_assignment_8.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="file_objects_test" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> | |
<module name="Python Exercises" /> | |
<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$" /> | |
<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="$PROJECT_DIR$/file_objects_test.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="learning_journal_unit3" type="PythonConfigurationType" factoryName="Python"> | |
<module name="Python Exercises" /> | |
<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$" /> | |
<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="$PROJECT_DIR$/learning_journal_unit3.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="new_inverse_dict" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> | |
<module name="Python Exercises" /> | |
<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$" /> | |
<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="$PROJECT_DIR$/new_inverse_dict.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="tryme4" type="PythonConfigurationType" factoryName="Python"> | |
<module name="Python Exercises" /> | |
<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$" /> | |
<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="$PROJECT_DIR$/tryme4.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="tuples" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> | |
<module name="Python Exercises" /> | |
<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$" /> | |
<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="$PROJECT_DIR$/tuples.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="unit7" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> | |
<module name="Python Exercises" /> | |
<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$" /> | |
<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="$PROJECT_DIR$/unit7.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> | |
<list> | |
<item itemvalue="Python.3.8.0" /> | |
<item itemvalue="Python.learning_journal_unit3" /> | |
<item itemvalue="Python.tryme4" /> | |
<item itemvalue="Python.tuples" /> | |
<item itemvalue="Python.unit7" /> | |
<item itemvalue="Python.file_objects_test" /> | |
<item itemvalue="Python.discussion_assignment_8" /> | |
<item itemvalue="Python.new_inverse_dict" /> | |
</list> | |
<recent_temporary> | |
<list> | |
<item itemvalue="Python.new_inverse_dict" /> | |
<item itemvalue="Python.discussion_assignment_8" /> | |
<item itemvalue="Python.file_objects_test" /> | |
<item itemvalue="Python.unit7" /> | |
<item itemvalue="Python.tuples" /> | |
</list> | |
</recent_temporary> | |
</component> | |
<component name="ServiceViewManager"> | |
<option name="viewStates"> | |
<list> | |
<serviceView> | |
<treeState> | |
<expand /> | |
<select /> | |
</treeState> | |
</serviceView> | |
</list> | |
</option> | |
</component> | |
<component name="SvnConfiguration"> | |
<configuration /> | |
</component> | |
<component name="TaskManager"> | |
<task active="true" id="Default" summary="Default task"> | |
<changelist id="76b6a88b-23ce-48c0-bdf4-7e086a9e1e30" name="Default Changelist" comment="" /> | |
<created>1574558731326</created> | |
<option name="number" value="Default" /> | |
<option name="presentableId" value="Default" /> | |
<updated>1574558731326</updated> | |
</task> | |
<servers /> | |
</component> | |
<component name="WindowStateProjectService"> | |
<state width="1515" height="198" key="GridCell.Tab.0.bottom" timestamp="1578443821921"> | |
<screen x="0" y="0" width="1536" height="824" /> | |
</state> | |
<state width="1515" height="198" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1578443821921" /> | |
<state width="1515" height="198" key="GridCell.Tab.0.center" timestamp="1578443821920"> | |
<screen x="0" y="0" width="1536" height="824" /> | |
</state> | |
<state width="1515" height="198" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1578443821920" /> | |
<state width="1515" height="198" key="GridCell.Tab.0.left" timestamp="1578443821920"> | |
<screen x="0" y="0" width="1536" height="824" /> | |
</state> | |
<state width="1515" height="198" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1578443821920" /> | |
<state width="1515" height="198" key="GridCell.Tab.0.right" timestamp="1578443821921"> | |
<screen x="0" y="0" width="1536" height="824" /> | |
</state> | |
<state width="1515" height="198" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1578443821921" /> | |
<state x="321" y="59" key="SettingsEditor" timestamp="1578173372946"> | |
<screen x="0" y="0" width="1536" height="824" /> | |
</state> | |
<state x="321" y="59" key="SettingsEditor/0.0.1536.824@0.0.1536.824" timestamp="1578173372946" /> | |
<state x="465" y="235" key="com.intellij.ide.util.TipDialog" timestamp="1578438785092"> | |
<screen x="0" y="0" width="1536" height="824" /> | |
</state> | |
<state x="465" y="235" key="com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824" timestamp="1578438785092" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def absolute_value(x, y): | |
if x > y: | |
return 1 | |
elif x == y: | |
return 0 | |
elif x < y: | |
return -1 | |
absolute_value(10, 5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def distance(x1, y1, x2, y2): | |
dx = x2 - x1 | |
dy = y2 - y1 | |
dsquared = dx ** 2 + dy ** 2 | |
result = math.sqrt(dsquared) | |
print(result) | |
return result | |
distance(1, 2, 4, 6) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This program will check if an integer is the power of another. | |
def is_power(num1, num2): | |
while num1 % num2 == 0: | |
num1 = num1/num2 | |
return num1 == 1 | |
# Print of the assignment requested results | |
print('is_power(10, 2) returns: ', is_power(10, 2)) | |
print('is_power(27, 3) returns: ', is_power(27, 3)) | |
print('is_power(1, 1) returns: ', is_power(1, 1)) | |
print('is_power(10, 1) returns', is_power(10, 1)) | |
print('is_power(3, 3) returns', is_power(3, 3)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function, division | |
# here is a mostly-straightforward solution to the | |
# two-by-two version of the grid. | |
def do_twice(f): | |
f() | |
f() | |
def do_four(f): | |
do_twice(f) | |
do_twice(f) | |
def print_beam(): | |
print('+ - - - -', end=' ') | |
def print_post(): | |
print('| ', end=' ') | |
def print_beams(): | |
do_twice(print_beam) | |
print('+') | |
def print_posts(): | |
do_twice(print_post) | |
print('|') | |
def print_row(): | |
print_beams() | |
do_four(print_posts) | |
def print_grid(): | |
do_twice(print_row) | |
print_beams() | |
print_grid() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Discussion Assignment 8: Catching exceptions | |
# Example 1: trying to open a file that does not exists: | |
example1 = open('flopes_assignment.py') | |
print(example1) | |
# Example 2: trying to open a file a have no permission to: | |
example2 = open('denied_access.txt') | |
print(example2) | |
# Example 3: trying to open a directory instead of a file: | |
example3 = open(r'C:\\Users\\flfel\\Documents\\Faculdade_Ciência da Computação\\CS 1101 - Programming Fundamentals\\Python Exercises') | |
print(example3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Write your own function that illustrates a feature that you learned in this unit. | |
# My function will draw lines for reports and outputs | |
def draw_to_me(): | |
print('<3' * 80) | |
draw_to_me() | |
print('Hello, World!') | |
draw_to_me() | |
print('This is my own function for the \033[1;35mUoPeople\033[m ', end= | |
'\033[1;30mCS1101 Learning Journal Assignment\033[m for \033[1;30mUnit 2\033[m') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# function with local variable | |
def loc_var(smth1, smth2): | |
loc = smth1 + smth2 | |
print(loc) | |
smth1 = 'Felipe ' | |
smth2 = 'Lopes' | |
loc_var(smth1, smth2) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
def square(t, lenght): | |
for i in range(4): | |
t.fd(lenght) | |
t.lt(90) | |
bob = turtle.Turtle() | |
square(bob, 100) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
def polygon(t, n, length): | |
angle = 360 / n | |
for i in range(n): | |
t.fd(length) | |
t.lt(angle) | |
bob = turtle.Turtle() | |
polygon(bob, 7, 70) | |
turtle.mainloop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from ex03 import polygon | |
def circle(t, r): | |
circumference = 2 * math.pi * r | |
n = 50 | |
length = circumference / n | |
polygon(t, n, length) | |
circle() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# shows numbers that can multiplied by 3 | |
number_list = [30, 17, 31, 67, 73, 85, 40, 216, 4050] | |
multiplied_numbers = [x for x in number_list if x % 3 == 0] | |
print(multiplied_numbers) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nested statements | |
number_list = [30, 17, 31, 67, 73, 85, 40, 216, 4050] | |
for x in number_list: | |
if x % 3 == 0: | |
print(x) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# chained conditionals | |
x = 216 | |
y = 4050 | |
if x % 3 == 0 and y % 3 == 0: | |
print('Chained conditional') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
test = open('test_file.txt', 'w') | |
line1 = 'The house burnt\n' | |
line2 = 'The firemen came\n' | |
test.write(line1) | |
test.write(line2) | |
test.close() | |
cwd = os.getcwd() | |
print(cwd) | |
def walk(dirname): | |
for name in os.listdir(dirname): | |
path = os.path.join(dirname, name) | |
if os.path.isfile(path): | |
print(path) | |
else: | |
walk(path) | |
def walk2(dirname): | |
for root, dirs, files in os.walk(dirname): | |
for filename in files: | |
print(os.path.join(root, filename)) | |
if __name__ == '__main__': | |
walk('.') | |
walk2('.') | |
walk(cwd) | |
walk2(cwd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add(a,b): | |
c = a + b | |
print(c) | |
return c | |
a = int(input('Enter first value: ')) | |
b = int(input('Enter second value: ')) | |
result = add(a, b) | |
if result % 2 == 0: | |
print('this is an even number') | |
else: | |
print('this is an odd number') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The length of the hypotenuse of a right triangle can be found applying: | |
# The sum of the squares of the lengths of the other two sides. | |
import math | |
def hypotenuse(x, y): | |
hx = x ** 2 | |
hy = y ** 2 | |
hsquared = hx + hy | |
result = math.sqrt(hsquared) | |
print(result) | |
return result | |
hypotenuse(30, 16) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Write a Python program that does the following: | |
# 1. Create a string that is a long series of words separated by spaces. | |
my_string = 'Treat the Planet with the respect you would like people to treat yourself' | |
print(my_string) | |
# 2. Turn the string into a list of words using split | |
my_string_list = my_string.split() | |
print(my_string_list) | |
# 3. Delete three words from the list, but delete each one using a different kind of Python operation. | |
del my_string_list[8] | |
my_string_list.pop(9) | |
my_string_list.remove('people') | |
print(my_string_list) | |
# 4. Sort the list | |
sorting = my_string_list[:] | |
sorting.sort() | |
print(sorting) | |
# 5. Add new words to the list (three or more) using three different kinds of Python operation. | |
my_string_list.append('!') | |
my_string_list.insert(0, 'Start to') | |
new_my_string_list = my_string_list[:] | |
new_my_string_list.append(':)') | |
print(my_string_list) | |
print(new_my_string_list) | |
# 6. Turn the list of words back into a single string using join. | |
delimiter = ' ' | |
sentence1 = delimiter.join(my_string_list) | |
sentence2 = delimiter.join(new_my_string_list) | |
# 7. Print the string. | |
print(sentence1) | |
print(sentence2) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Provide your own examples of the following using Python lists. | |
# 1. Nested lists | |
comics_characters = [['Iron Man', 'Captain', 'Black Widow'], ['Batman', 'Robin', 'Superman'], ['Marvel', 'DC']] | |
print(comics_characters) | |
# 2. The * operator | |
multi_op = comics_characters * 2 | |
print(multi_op) | |
# 3. List slices | |
marvel_characteres = comics_characters[0] | |
marvel_female = marvel_characteres[2] | |
print(marvel_female) | |
# 4. The += operator | |
numbers = [5, 4, 3, 2, 1] | |
numbers += '54321' | |
print(numbers) | |
# 5. A list filter | |
numbers2 = numbers[2:3] | |
print(numbers2) | |
# 6. A list operation that is legal but does the wrong thing, not what the programmer expects | |
numbers3 = numbers[2:2] | |
print(numbers3) | |
# The code was expected to print [3], however the code is not correct. It should be [2:3] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# positive number counter | |
def countdown(n): | |
if n <= 0: | |
print('Blastoff!') | |
else: | |
print(n) | |
countdown(n-1) | |
# negative number counter | |
def countup(n): | |
if n >= -1: | |
print('Blastoff!') | |
else: | |
print(n) | |
countup(n+1) | |
# code to call the counter considering the user input | |
print('To initiate the counter please insert the number.' | |
'\nConsider positive or negative number.') | |
counter = int(input('Insert a number: ')) | |
if counter > 0: | |
print(countdown(counter)) | |
elif counter < 0: | |
print(countup(counter)) | |
else: | |
print('Blastoff!') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The volume of a sphere is 4/3πr³, where π has the vale of "pi". | |
# Write a function called print_volume(r) | |
from math import pi, pow | |
# function to find the sphere volume | |
def print_volume(r): | |
sphere_volume = ((4 / 3) * (r ** 3) * pi) # where r is for radius | |
print(sphere_volume) | |
# in case you need to find the radius of a sphere area | |
area = 6 | |
r = pow(area, (4 * pi)) | |
# shows the outputs for the radius and the sphere volume | |
print('=' * 20) | |
print('Based on the radius provided of {:.2f}, the sphere volume is:'.format(r)) | |
print('') | |
print('The volume of the sphere is: '), print_volume(r) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This function will perform different operations for the given number | |
def multi_table(num1, num2): | |
addnum = num1 + num2 | |
subnum = num1 - num2 | |
mulnum = num1 * num2 | |
divnum = num1 / num2 | |
expnum = num1 ** num2 | |
result = (addnum, subnum, mulnum, divnum, expnum) | |
print(result) | |
return result | |
multi_table(-20, 90) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a: Brazilian | |
b: Peruvian | |
c: Chilean | |
d: Mexican | |
e: Uruguayan | |
f: Caribbean | |
g: Pakistan | |
h: Indian | |
i: Italian | |
j: Russian | |
k: American | |
l: Roman | |
m: Britain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
# this code will draw a square on the new screen. | |
bob = turtle.Turtle() | |
for i in range(4): | |
bob.fd(100) | |
bob.lt(90) | |
print(bob) | |
turtle.mainloop() | |
for i in range(4): | |
print('Hello!') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def invert_dict(d): | |
inverse = dict() | |
for key in d: | |
val = d[key] | |
if val not in inverse: | |
inverse[val] = [key] | |
else: | |
inverse[val].append(key) | |
return inverse | |
my_dictionary = {'a': 'Brazilian', | |
'b': 'Peruvian', | |
'c': 'Chilean', | |
'd': 'Mexican'} | |
print('This is my inverted dictionary:') | |
print(invert_dict(my_dictionary)) | |
print('') | |
print('This is my original dictionary:') | |
print(my_dictionary) | |
print('') | |
print('This is my new dictionary from my dict_file') | |
dic_file = open('my_dict.txt', 'r') | |
lines = dic_file.readlines() | |
for line in lines: | |
entries = line.split() | |
register = dict() | |
code = entries[0] | |
name = entries[-1] | |
register[code] = name | |
print(register) | |
dic_file.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eng2sp = {'one': 'uno', 'two': 'dos', 'three': 'tres', 'four': 'cuatro', 'five': 'cinco', 'six': 'seis'} | |
print(eng2sp) | |
print(eng2sp['two']) | |
print(len(eng2sp)) | |
print('two' in eng2sp) | |
print('seven' in eng2sp) | |
print('tres' in eng2sp) | |
vals = eng2sp.values() | |
print('tres' in vals) | |
print('siete' in vals) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# string slices examples | |
sentence = 'Joker is Batman #1 rival' | |
print(sentence) | |
print('') | |
print('Based on this we can assume that:') | |
print("Batman's #1 enemy name: ", sentence[0:5]) | |
print("Joker is Batman's enemy number: ", sentence[16:18]) | |
print('We can also say that: ', sentence[9:15], sentence[6:8], sentence[0:5], sentence[16:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def any_lowercase1(s): | |
for c in s: | |
if c.islower(): | |
return True # check every character in the string is a lowercase character and return a boolean value | |
else: | |
return False | |
def any_lowercase2(s): | |
for c in s: | |
if 'c'.islower(): # always return a string 'true' since 'c' is a lowercase no matter how many characters are | |
# in the string | |
return 'True' | |
else: | |
return 'False' | |
def any_lowercase3(s): | |
for c in s: | |
flag = c.islower() # check if the last character in the string is a lower case, return a boolean value | |
return flag | |
def any_lowercase4(s): | |
flag = False | |
for c in s: | |
flag = flag or c.islower() # check if the last character in the string is a lower case, return a boolean value | |
return flag | |
def any_lowercase5(s): | |
for c in s: | |
if not c.islower(): | |
return False # check if every character in the string is a lower case, return a boolean value False if not | |
return True | |
string_test = 'Good Morning!' | |
print(any_lowercase1(string_test)) | |
print(any_lowercase2(string_test)) | |
print(any_lowercase3(string_test)) | |
print(any_lowercase4(string_test)) | |
print(any_lowercase5(string_test)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calc_adiantamento(salario, dias): | |
salario = float(input('Insira salário: R$ ')) | |
dias = int(input('Insira quantidade de dias trabalhados: ')) | |
if dias < 15: | |
print('Funcionário não possui direito a adiantamento') | |
else: | |
base_adiantamento = float((salario / 30) * dias) | |
adiantamento = float(base_adiantamento * 0.40) | |
print('Funcionário receberá R$ {:.2f} de adiantamento salarial'.format(adiantamento)) | |
calc_adiantamento(salario=0, dias=0) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def retorna_personagem(personagens, indice): | |
personagem = personagens________.capitalize | |
return personagem | |
personagens = ['mario', 'link', 'donkey kong', 'zelda', 'pikachu'] | |
personagem = retorna_personagem('pikachu', 4) | |
print(personagem) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(10.) | |
print(isinstance(n, float), isinstance(n * 1.0, float)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''''def countdown(n): | |
while n > 0: | |
print(n) | |
n = n -1 | |
print('Blastoff!') | |
countdown(10)''''' | |
'''''def sequence(n): | |
while n != 1: | |
print(n) | |
if n % 2 == 0: # even | |
n = n / 2 | |
else: | |
n = n * 3 + 1 # odd | |
n = int(input('Number: ')) | |
sequence(n)''''' | |
'''def countdown(n): | |
while n != 0: | |
print(n) | |
if n <= 0: | |
print('Blastoff!') | |
break | |
else: | |
countdown(n-1) | |
break | |
countdown(20)''' | |
def mysqrt(a): | |
epsilon = 0.00001 | |
x = 5.00000 | |
while True: | |
y = (x + a/x) / 2 | |
if abs(y - x) < epsilon: | |
return y | |
break | |
x = y | |
import math | |
print(mysqrt(4)) | |
def test_square_root(): | |
print('a mysqrt(a) math.sqrt(a) diff') | |
print('- ---------- ------------ --------') | |
for a in range(1, 26): | |
print('%.1f %.5f %5f %f' % (a, mysqrt(a), math.sqrt(a), mysqrt(a) - math.sqrt(a))) | |
test_square_root() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This function details the list arguments and their indexes. | |
# The arguments of the list are all integers | |
def counter(n): | |
for x, y in enumerate(n): # shows the list indexes | |
print(f'The index {x} receives {y}') # x refers to the object | |
numbers = [10, 6, 8, 20, 50, 75, 81] | |
print(counter(numbers)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The house burnt | |
The firemen came |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the period represents the line's empty space output | |
def new_line(): | |
print('.') | |
# a sequence of three periods must be the output of this function | |
def three_lines(): | |
new_line() | |
new_line() | |
new_line() | |
# a sequence of nine periods must be the output of this function | |
def nine_lines(): | |
three_lines() | |
three_lines() | |
three_lines() | |
# the clear_screen function must show a sequence of 25 dots on its output | |
def clear_screen(): | |
nine_lines() | |
nine_lines() | |
three_lines() | |
three_lines() | |
new_line() | |
# this program must show two results: 1) a sequence of 9 dots, and 2) a sequence of 25 dots. | |
print('=' * 10, 'Calling nine_lines', '=' * 10) | |
print(nine_lines()) | |
print('=' * 10, 'Calling clear_screen', '=' * 10) | |
print(clear_screen()) | |
print('End of the program') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ingredients = 'flour', 'salt', 'milk', 'sugar' | |
order = [0, 1, 2, 3] | |
zip(order, ingredients) | |
print(zip(order, ingredients)) | |
def recipe(): | |
for cooking in zip(order, ingredients): | |
print(cooking) | |
recipe() | |
for index, element in enumerate(ingredients): | |
print(index, element) | |
cook_dict = zip(order, ingredients) | |
bake_dict = dict(cook_dict) | |
print(bake_dict) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
bob = turtle.Turtle() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mysqrt(a): | |
epsilon = 0.00001 | |
x = 5.00000 | |
while True: | |
y = (x + a/x) / 2 | |
if abs(y - x) < epsilon: | |
return y | |
break | |
x = y | |
import math | |
print(mysqrt(4)) | |
def test_square_root(): | |
print('a mysqrt(a) math.sqrt(a) diff') | |
print('- ---------- ------------ --------') | |
for a in range(1, 26): | |
print('%.1f %.5f %5f %f' % (a, mysqrt(a), math.sqrt(a), mysqrt(a) - math.sqrt(a))) | |
test_square_root() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alphabet = "abcdefghijklmnopqrstuvwxyz" | |
test_dups = ["zzz", "dog", "bookkeeper", "subdermatoglyphic", "subdermatoglyphics"] | |
test_miss = ["zzz", "subdermatoglyphic", "the quick brown fox jumps over the lazy dog"] | |
# From Section 11.2 of: | |
# Downey, A. (2015). Think Python: How to think like a computer scientist. Needham, Massachusetts: Green Tree Press. | |
def histogram(s): | |
d = dict() | |
for c in s: | |
if c not in d: | |
d[c] = 1 | |
else: | |
d[c] += 1 | |
return d | |
def has_duplicates(s): | |
# Return False if each letter in s is not distinct | |
return len(histogram(s)) != len(s) | |
def missing_letters(s): | |
h = histogram(s) | |
rv = '' | |
# Loop over letters in alphabet, if the letter is not in the histogram then | |
# append to the return string. | |
for c in alphabet: | |
if c not in h: | |
rv = rv + c | |
return rv | |
# Loop over test strings as required. | |
for s in test_miss: | |
miss = missing_letters(s) | |
if miss: | |
print(f"{s} is missing letters {miss}.") | |
else: | |
print(f"{s} uses all the letters.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment