Q&A for How to Start Programming in Python

Return to Full Article

Search
Add New Question
  • Question
    How can I check if a package has been installed in Python?
    Kevin Burnett
    Software Developer
    Kevin Burnett is a Software Developer with over 20 years of professional experience. He works for SpiffWorkflow, a Python Process Automation tool for organizations. Prior to SpiffWorkflow, he spent the majority of his career at Rosetta Stone, a language-learning software company. He has experience with both front and back-end development and works primarily in Python, Ruby, and JavaScript. He attended the first RailsConf and the most recent PyCon US. He received an MBA and a BA in Computer Science and Spanish from Eastern Mennonite University.
    Software Developer
    Expert Answer
    From within a Python program, you use a built-in standard library utility, called Find spec. And so you import, import lib.util. And then, you can call Find spec on that, and you give it whatever package you want to know about. That thing can directly tell you whether it has been installed or not.
  • Question
    Can I create my own game using Python?
    Community Answer
    Yes, if you have the programming skills and a computer/laptop with enough storage.
  • Question
    What is Python language and why is it used?
    Community Answer
    Python is an easy to use, fun and easy to learn programming language that is smaller and more compressed than C, C++, Java or binary. You can automate more things in one sentence than in single files alone. Another pro of using Python is that you can test your code whenever you need to, and it is just a simple save.
  • Question
    Where can I find tutorials?
    Community Answer
    YouTube is the most common website to use but people's programming blogs also help. There are various online academies with free tutorials as well, such as Code Academy and Khan Academy.
  • Question
    How long does it take to learn Python?
    Mr0
    Community Answer
    A day or two to learn the basics, but it could take months to learn and master the language.
  • Question
    How do I make comments on Python?
    Community Answer
    To add a comment in Python, you can just type a "#" followed by whatever comment you want to add.
  • Question
    Can we hack any site using python?
    Community Answer
    It isn't advised to hack, because it can end you up in jail. However, if you are allowed, you technically can, although it requires a high level of intelligence.
  • Question
    How can I go back and fix my mistakes?
    Community Answer
    You can't. However, if you create the code in a new file, then the whole file is editable. Just run the code afterwards (F5).
  • Question
    How do I save my file in Python?
    Bryan Hadland
    Community Answer
    If you're talking about a Python file, press Ctrl+S and save it as "yourfile.py".
  • Question
    How can I code for the extraction of part of speech tagging in the particular sentence?
    Community Answer
    This requires an algorithm that matches exactly what the word is and how it is used in the sentence. You may also require a reference for the words such as a dictionary (txt file), another file that sorts out the words and some grammar checkers.
  • Question
    Can we make mobile apps using Python?
    Emmanuel Ogunjobi
    Community Answer
    Yes, you can. App developers now optimize Python for mobile development using tools like CPython, PySide, etc. An advantage of building apps in Python is in consideration of the quick turnaround time (TAT) of the Python language.
  • Question
    How I can I learn programming Android with Python?
    Mr0
    Community Answer
    Dcode and Sololearn have "code playgrounds" that allow you to program in a variety of languages. They are both available to download for free on Google Play Store.
  • Question
    How do you make the shapes come up on your screen?
    nicholasz2510 Gaming, Travel, and Music
    Community Answer
    There are many modules that can be used to draw objects in a window. You should use Tkinter or Pygame. There are many tutorials online on how to use them.
  • Question
    Can I do memory programming in Python?
    Bryan Hadland
    Community Answer
    No, Python does it for you. Use a higher level language, like C.
  • Question
    Can I make very complex games using Python?
    Mr0
    Community Answer
    Yes, you can make a complex game using any high-level programming language.
  • Question
    How can I open terminal?
    Secret Superman
    Community Answer
    On a Mac click command + space and type in terminal. Terminal is also on Linux, but now on Windows.
  • Question
    What modules do I need to be able to place a colored dot at a specific location on the monitor?
    Community Answer
    All you need is the turtle module; this will open a Tk window environment. The documentation for the turtle module is at docs.python.org.
  • Question
    Can you use it to build an advanced online platform?
    Community Answer
    Yes, but you will have to also use other languages like HTML, CSS etc. for certain parts. Reddit, for example, uses Python.
  • Question
    I am stuck where it says open command prompt (Windows) in your terminal Mac/Linux. What does it mean by terminal Mac/Linux?
    Maxim R
    Community Answer
    It means that if you are a Windows user, open your command prompt. If you are a Mac/lLnux user, open your terminal.
  • Question
    Does Python require internet access?
    Maxim R
    Community Answer
    Installing Python requires internet access, but once you have it installed, no internet is required.
  • Question
    How to delete a directory in Python?
    Community Answer
    For empty directories: import os os.rmdir For directories with files: import shutil shutil.rmtree('PATH_HERE')
  • Question
    How to learn OOP in Python? I found this frustrating.
    Invisible One
    Community Answer
    Start by looking into w3schools tutorials, they have some good ones on OOP. Object-Oriented Programming can be confusing at first, but once you understand it, it isn't as difficult as you might think. In Python, you create a class by using the keyword 'class' and then the name of your class, followed by two parentheses and a colon. Inside of a class, you can define more classes, functions, or variables and use those functions, variables, or classes. We can also create a class that can be reused every time we want to make another object.
  • Question
    Can you connect to other devices using Python?
    Invisible One
    Community Answer
    Yes, you can create a socket server and connect to it with a client. If you want to do this, it would be a good idea to learn Socket programming.
  • Question
    Is Python interesting to use?
    Community Answer
    Yes indeed, as it opens up many possibilities in programming and is mostly easy to understand.
  • Question
    If I open a Python file after downloading, it shows its own terminal, which one looks like Notepad and another like CMD. Is this normal?
    Simeon Watson
    Community Answer
    That is how it just works. To edit, you must download an IDE (for example, IDLE, Thonny, Visual Studio Code, PyCharm) and edit there. To open a file in an IDE, you must right click the file and choose "edit with {name of your IDE}".
  • Question
    Which Python version should I download for Windows 7?
    Simeon Watson
    Community Answer
    Any you want, it works on well on all versions. But do upgrade to the the newest version of Windows (Windows 10) first.
  • Question
    In a print statement (command), how do you tab along a line to get your text moved to the right along the screen?
    Simeon Watson
    Community Answer
    If I understand your question correctly, this is the answer: print('''This is text. this text is indented''').
  • Question
    How do you calculate discount using Python?
    Simeon Watson
    Community Answer
    This would be as follows: original = float(input("Original price: ")) discount = float(input("Percent discount: ")) result = (1-(discount/100))*original print(f"You will pay {result} when discount is calculated. ")
  • Question
    Can I use a mobile phone to install Python?
    Pm_7
    Community Answer
    Yes, the Python IDE is available on Google Play if you have an Android phone.
  • Question
    I'm having a Python problem. I want to convert my Python file to an exe file, but I can not use PyPi to download the only py2exe file. Is there a way to get out of this endless loophole?
    0Shadow
    Community Answer
    If you can't download py2exe , then try pyinstaller instead or other app building packages from PyPi and other reputable websites. If you don't have access to the internet, get the offline zipped file or .whl file from someone else.
Ask a Question

      Return to Full Article