GithubHelp home page GithubHelp logo

introduction_to_python's Introduction

Introduction to Python course (JetBrains Academy version) official JetBrains project

This is an introductory Python course by JetBrains Academy. The target audience are the people with little or no experience in programming who would like to start learning Python.

In this course, you will learn about the basics, such as variables and operations with them, strings and other data structures, boolean operators, conditions, control flow, and so on. You will try implementing loops, functions, and classes, as well as using parts of your code as imported modules, and working with text files.

Have fun and good luck!

Want to know more?

If you have questions about the course or the tasks, or if you find any errors, feel free to ask questions and participate in discussions within the repository issues.

Contribution

Please be sure to review the project's contributing guidelines to learn how to help the project.

introduction_to_python's People

Contributors

gabriele-ricciardi avatar geravant avatar igalimov avatar jjkester avatar kochaika avatar medvector avatar nayakayp avatar richardbrinkman avatar rwp0 avatar sofiiako avatar stephen-hero avatar yopox avatar zoyakostyreva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

introduction_to_python's Issues

Wrong operator in boolean_order.py

There is an operator "is" used incorrectly on line 8 of Condition expressions/Boolean operators order/boolean_order.py:
print(name is "Ellis" or not (name is "John" and age == 17))

there should be operator ==

Variables / Variable Definition

"Check" button always shows incorect after checking
/usr/bin/python3.10 /home/sridip/pycharm-community-2022.3/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py --path /home/sridip/PycharmProjects/Introduction to Python/Variables/Variable definition/tests/test_task.py
Testing started at 10:19 pm ...
Launching pytest with arguments /home/sridip/PycharmProjects/Introduction to Python/Variables/Variable definition/tests/test_task.py --no-header --no-summary -q in /home/sridip/PycharmProjects/Introduction to Python/Variables/Variable definition

============================= test session starts ==============================
collecting ... collected 4 items

tests/test_task.py::TestCase::test_assignment_operator FAILED [ 25%]
tests/test_task.py:28 (TestCase.test_assignment_operator)
self = <test_task.TestCase testMethod=test_assignment_operator>

def setUp(self):
    try:
        # Stores output from print() in actualOutput
        with patch('sys.stdout', new=StringIO()) as self.actualOutput:
            # Loads submission on first test, reloads on subsequent tests
            if self.task_name in sys.modules:
                importlib.reload(sys.modules[self.task_name])
            else:
              importlib.import_module(self.task_name)

tests/test_task.py:24:


name = 'variable_definition', package = None

def import_module(name, package=None):
    """Import a module.

    The 'package' argument is required when performing a relative import. It
    specifies the package to use as the anchor point from which to resolve the
    relative import to an absolute import.

    """
    level = 0
    if name.startswith('.'):
        if not package:
            msg = ("the 'package' argument is required to perform a relative "
                   "import for {!r}")
            raise TypeError(msg.format(name))
        for character in name:
            if character != '.':
                break
            level += 1
  return _bootstrap._gcd_import(name[level:], package, level)

/usr/lib/python3.10/importlib/init.py:126:


name = 'variable_definition', package = None, level = 0

???

:1050:


name = 'variable_definition', import_ = <function _gcd_import at 0x7f7591983400>

???

:1027:


name = 'variable_definition', import_ = <function _gcd_import at 0x7f7591983400>

???
E ModuleNotFoundError: No module named 'variable_definition'

:1004: ModuleNotFoundError

During handling of the above exception, another exception occurred:

self = <test_task.TestCase testMethod=test_assignment_operator>

def setUp(self):
    try:
        # Stores output from print() in actualOutput
        with patch('sys.stdout', new=StringIO()) as self.actualOutput:
            # Loads submission on first test, reloads on subsequent tests
            if self.task_name in sys.modules:
                importlib.reload(sys.modules[self.task_name])
            else:
                importlib.import_module(self.task_name)
    except Exception as e:
      self.fail("There was a problem while loading the solution – {0}. Check the solution for IDE-highlighted "
                  "errors and warnings.".format(str(e)))

E AssertionError: There was a problem while loading the solution – No module named 'variable_definition'. Check the solution for IDE-highlighted errors and warnings.

tests/test_task.py:26: AssertionError
FAILED [ 50%]
tests/test_task.py:37 (TestCase.test_assignment_operator2)
self = <test_task.TestCase testMethod=test_assignment_operator2>

def setUp(self):
    try:
        # Stores output from print() in actualOutput
        with patch('sys.stdout', new=StringIO()) as self.actualOutput:
            # Loads submission on first test, reloads on subsequent tests
            if self.task_name in sys.modules:
                importlib.reload(sys.modules[self.task_name])
            else:
              importlib.import_module(self.task_name)

tests/test_task.py:24:


name = 'variable_definition', package = None

def import_module(name, package=None):
    """Import a module.

    The 'package' argument is required when performing a relative import. It
    specifies the package to use as the anchor point from which to resolve the
    relative import to an absolute import.

    """
    level = 0
    if name.startswith('.'):
        if not package:
            msg = ("the 'package' argument is required to perform a relative "
                   "import for {!r}")
            raise TypeError(msg.format(name))
        for character in name:
            if character != '.':
                break
            level += 1
  return _bootstrap._gcd_import(name[level:], package, level)

/usr/lib/python3.10/importlib/init.py:126:


name = 'variable_definition', package = None, level = 0

???

:1050:


name = 'variable_definition', import_ = <function _gcd_import at 0x7f7591983400>

???

:1027:


name = 'variable_definition', import_ = <function _gcd_import at 0x7f7591983400>

???
E ModuleNotFoundError: No module named 'variable_definition'

:1004: ModuleNotFoundError

During handling of the above exception, another exception occurred:

self = <test_task.TestCase testMethod=test_assignment_operator2>

def setUp(self):
    try:
        # Stores output from print() in actualOutput
        with patch('sys.stdout', new=StringIO()) as self.actualOutput:
            # Loads submission on first test, reloads on subsequent tests
            if self.task_name in sys.modules:
                importlib.reload(sys.modules[self.task_name])
            else:
                importlib.import_module(self.task_name)
    except Exception as e:
      self.fail("There was a problem while loading the solution – {0}. Check the solution for IDE-highlighted "
                  "errors and warnings.".format(str(e)))

E AssertionError: There was a problem while loading the solution – No module named 'variable_definition'. Check the solution for IDE-highlighted errors and warnings.

tests/test_task.py:26: AssertionError
FAILED [ 75%]
tests/test_task.py:58 (TestCase.test_chained_assignment)
self = <test_task.TestCase testMethod=test_chained_assignment>

def setUp(self):
    try:
        # Stores output from print() in actualOutput
        with patch('sys.stdout', new=StringIO()) as self.actualOutput:
            # Loads submission on first test, reloads on subsequent tests
            if self.task_name in sys.modules:
                importlib.reload(sys.modules[self.task_name])
            else:
              importlib.import_module(self.task_name)

tests/test_task.py:24:


name = 'variable_definition', package = None

def import_module(name, package=None):
    """Import a module.

    The 'package' argument is required when performing a relative import. It
    specifies the package to use as the anchor point from which to resolve the
    relative import to an absolute import.

    """
    level = 0
    if name.startswith('.'):
        if not package:
            msg = ("the 'package' argument is required to perform a relative "
                   "import for {!r}")
            raise TypeError(msg.format(name))
        for character in name:
            if character != '.':
                break
            level += 1
  return _bootstrap._gcd_import(name[level:], package, level)

/usr/lib/python3.10/importlib/init.py:126:


name = 'variable_definition', package = None, level = 0

???

:1050:


name = 'variable_definition', import_ = <function _gcd_import at 0x7f7591983400>

???

:1027:


name = 'variable_definition', import_ = <function _gcd_import at 0x7f7591983400>

???
E ModuleNotFoundError: No module named 'variable_definition'

:1004: ModuleNotFoundError

During handling of the above exception, another exception occurred:

self = <test_task.TestCase testMethod=test_chained_assignment>

def setUp(self):
    try:
        # Stores output from print() in actualOutput
        with patch('sys.stdout', new=StringIO()) as self.actualOutput:
            # Loads submission on first test, reloads on subsequent tests
            if self.task_name in sys.modules:
                importlib.reload(sys.modules[self.task_name])
            else:
                importlib.import_module(self.task_name)
    except Exception as e:
      self.fail("There was a problem while loading the solution – {0}. Check the solution for IDE-highlighted "
                  "errors and warnings.".format(str(e)))

E AssertionError: There was a problem while loading the solution – No module named 'variable_definition'. Check the solution for IDE-highlighted errors and warnings.

tests/test_task.py:26: AssertionError
FAILED [100%]
tests/test_task.py:46 (TestCase.test_variable)
self = <test_task.TestCase testMethod=test_variable>

def setUp(self):
    try:
        # Stores output from print() in actualOutput
        with patch('sys.stdout', new=StringIO()) as self.actualOutput:
            # Loads submission on first test, reloads on subsequent tests
            if self.task_name in sys.modules:
                importlib.reload(sys.modules[self.task_name])
            else:
              importlib.import_module(self.task_name)

tests/test_task.py:24:


name = 'variable_definition', package = None

def import_module(name, package=None):
    """Import a module.

    The 'package' argument is required when performing a relative import. It
    specifies the package to use as the anchor point from which to resolve the
    relative import to an absolute import.

    """
    level = 0
    if name.startswith('.'):
        if not package:
            msg = ("the 'package' argument is required to perform a relative "
                   "import for {!r}")
            raise TypeError(msg.format(name))
        for character in name:
            if character != '.':
                break
            level += 1
  return _bootstrap._gcd_import(name[level:], package, level)

/usr/lib/python3.10/importlib/init.py:126:


name = 'variable_definition', package = None, level = 0

???

:1050:


name = 'variable_definition', import_ = <function _gcd_import at 0x7f7591983400>

???

:1027:


name = 'variable_definition', import_ = <function _gcd_import at 0x7f7591983400>

???
E ModuleNotFoundError: No module named 'variable_definition'

:1004: ModuleNotFoundError

During handling of the above exception, another exception occurred:

self = <test_task.TestCase testMethod=test_variable>

def setUp(self):
    try:
        # Stores output from print() in actualOutput
        with patch('sys.stdout', new=StringIO()) as self.actualOutput:
            # Loads submission on first test, reloads on subsequent tests
            if self.task_name in sys.modules:
                importlib.reload(sys.modules[self.task_name])
            else:
                importlib.import_module(self.task_name)
    except Exception as e:
      self.fail("There was a problem while loading the solution – {0}. Check the solution for IDE-highlighted "
                  "errors and warnings.".format(str(e)))

E AssertionError: There was a problem while loading the solution – No module named 'variable_definition'. Check the solution for IDE-highlighted errors and warnings.

tests/test_task.py:26: AssertionError

tests/test_task.py::TestCase::test_assignment_operator2
tests/test_task.py::TestCase::test_chained_assignment
tests/test_task.py::TestCase::test_variable

============================== 4 failed in 0.14s ===============================

Process finished with exit code 1

Test Issue Test

Something does not work here

Check your repr() method.
<str_and_repr.Cat object at 0x10b2aabb0> != Cat, breed: sphynx, name: Kitty

Expected :Cat, breed: sphynx, name: Kitty
Actual :<str_and_repr.Cat object at 0x10b2aabb0>

Traceback (most recent call last):
File "/Users/Sofia.Kolchanova/Desktop/Introduction to Python/Classes and objects/str vs repr/tests/test_task.py", line 16, in test_repr
self.assertEqual(expected, actual, msg='Check your repr() method.')
AssertionError: 'Cat, breed: sphynx, name: Kitty' != '<str_and_repr.Cat object at 0x10b2aabb0>'

  • Cat, breed: sphynx, name: Kitty
  • <str_and_repr.Cat object at 0x10b2aabb0>
    : Check your repr() method.

Clicking "Next" breaks the UI. Variables / Undefined Variable - Not just this one

Before clicking "Next", I can interact with the Editor. Right click context menu and insert '|' prompt available for interaction. After clicking "Next", these two (at the very least) interface elements stop working. At first I thought that the .py file had become read-only. I'm not completely sure this isn't the case. No error messages are generated. I've tried watching the text output to the launch terminal, and examining the logs. I haven't been able to identify what the particular error is.

It is momentarily fixed by using: File -> Repair IDE -> Recovery step 3: 'Reopen Project' ". Doing this restores editor interaction... until 'Next' is clicked again. 100% reproducible.

I'm hoping someone can provide suggestions on how to better diagnose the issue.
I've checked for the Run tool window, but it isn't visible in my IDE. Where your illustration shows

"Version Control, >Run, =TODO, ... etc."

mine shows

"Version Control, Python Packages, =TODO, ... etc."

Check button didn't work Strings / String Slicing

If I type anything on the task the check button didn't work with this message: "Failed to launch checking. For more information, see the Troubleshooting guide".
I didn't have any error message because the check button didn't work.

Variables / Arithmetic Operators

In the task you're asked to add the 'division result' with the 'multiplication result' but the solution requires the 'division remainder' to be added to the 'multiplication result'.

Essentially what the task calls for vs what the solution are don't match.

Incorrect "output" showed Functions / Recursion

Hi guys, in your example in description you are providing "4" as an argument for function "countdown(n)" and as result of execution of this function you showed: "10 9 8 7 6 5 4 3 2 1 0" what is incorrect of course, because countdown will start from 4 and not 10. So, correct execution result should be: "4 3 2 1 0 "

Introduction / Comments

When I am clicking the option "CHECK' in task window it is showing "Incorect" everytime. But I did everything what the task instructed me to do.
/usr/bin/python3.10 /home/sridip/pycharm-community-2022.3/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py --path /home/sridip/PycharmProjects/Introduction to Python/Introduction/Comments/tests/test_task.py
Testing started at 10:11 pm ...
Launching pytest with arguments /home/sridip/PycharmProjects/Introduction to Python/Introduction/Comments/tests/test_task.py --no-header --no-summary -q in /home/sridip/PycharmProjects/Introduction to Python/Introduction/Comments

============================= test session starts ==============================
collecting ... collected 2 items

tests/test_task.py::TestCase::test_assignment_operator FAILED [ 50%]
tests/test_task.py:28 (TestCase.test_assignment_operator)
self = <test_task.TestCase testMethod=test_assignment_operator>

def setUp(self):
    try:
        # Stores output from print() in actualOutput
        with patch('sys.stdout', new=StringIO()) as self.actualOutput:
            # Loads submission on first test, reloads on subsequent tests
            if self.task_name in sys.modules:
                importlib.reload(sys.modules[self.task_name])
            else:
              importlib.import_module(self.task_name)

tests/test_task.py:24:


name = 'comments', package = None

def import_module(name, package=None):
    """Import a module.

    The 'package' argument is required when performing a relative import. It
    specifies the package to use as the anchor point from which to resolve the
    relative import to an absolute import.

    """
    level = 0
    if name.startswith('.'):
        if not package:
            msg = ("the 'package' argument is required to perform a relative "
                   "import for {!r}")
            raise TypeError(msg.format(name))
        for character in name:
            if character != '.':
                break
            level += 1
  return _bootstrap._gcd_import(name[level:], package, level)

/usr/lib/python3.10/importlib/init.py:126:


name = 'comments', package = None, level = 0

???

:1050:


name = 'comments', import_ = <function _gcd_import at 0x7fb59e19f400>

???

:1027:


name = 'comments', import_ = <function _gcd_import at 0x7fb59e19f400>

???
E ModuleNotFoundError: No module named 'comments'

:1004: ModuleNotFoundError

During handling of the above exception, another exception occurred:

self = <test_task.TestCase testMethod=test_assignment_operator>

def setUp(self):
    try:
        # Stores output from print() in actualOutput
        with patch('sys.stdout', new=StringIO()) as self.actualOutput:
            # Loads submission on first test, reloads on subsequent tests
            if self.task_name in sys.modules:
                importlib.reload(sys.modules[self.task_name])
            else:
                importlib.import_module(self.task_name)
    except Exception as e:
      self.fail("There was a problem while loading the solution – {0}. Check the solution for IDE-highlighted "
                  "errors and warnings.".format(str(e)))

E AssertionError: There was a problem while loading the solution – No module named 'comments'. Check the solution for IDE-highlighted errors and warnings.

tests/test_task.py:26: AssertionError
FAILED [100%]
tests/test_task.py:35 (TestCase.test_output_len)
self = <test_task.TestCase testMethod=test_output_len>

def setUp(self):
    try:
        # Stores output from print() in actualOutput
        with patch('sys.stdout', new=StringIO()) as self.actualOutput:
            # Loads submission on first test, reloads on subsequent tests
            if self.task_name in sys.modules:
                importlib.reload(sys.modules[self.task_name])
            else:
              importlib.import_module(self.task_name)

tests/test_task.py:24:


name = 'comments', package = None

def import_module(name, package=None):
    """Import a module.

    The 'package' argument is required when performing a relative import. It
    specifies the package to use as the anchor point from which to resolve the
    relative import to an absolute import.

    """
    level = 0
    if name.startswith('.'):
        if not package:
            msg = ("the 'package' argument is required to perform a relative "
                   "import for {!r}")
            raise TypeError(msg.format(name))
        for character in name:
            if character != '.':
                break
            level += 1
  return _bootstrap._gcd_import(name[level:], package, level)

/usr/lib/python3.10/importlib/init.py:126:


name = 'comments', package = None, level = 0

???

:1050:


name = 'comments', import_ = <function _gcd_import at 0x7fb59e19f400>

???

:1027:


name = 'comments', import_ = <function _gcd_import at 0x7fb59e19f400>

???
E ModuleNotFoundError: No module named 'comments'

:1004: ModuleNotFoundError

During handling of the above exception, another exception occurred:

self = <test_task.TestCase testMethod=test_output_len>

def setUp(self):
    try:
        # Stores output from print() in actualOutput
        with patch('sys.stdout', new=StringIO()) as self.actualOutput:
            # Loads submission on first test, reloads on subsequent tests
            if self.task_name in sys.modules:
                importlib.reload(sys.modules[self.task_name])
            else:
                importlib.import_module(self.task_name)
    except Exception as e:
      self.fail("There was a problem while loading the solution – {0}. Check the solution for IDE-highlighted "
                  "errors and warnings.".format(str(e)))

E AssertionError: There was a problem while loading the solution – No module named 'comments'. Check the solution for IDE-highlighted errors and warnings.

tests/test_task.py:26: AssertionError

tests/test_task.py::TestCase::test_output_len

============================== 2 failed in 0.07s ===============================

Process finished with exit code 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.