Git Product home page Git Product logo

pcc_3e's Introduction

pcc_3e's People

Contributors

ehmatthes avatar ericwlange 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  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  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  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

pcc_3e's Issues

UnboundLocalError: local variable 'range' referenced before assignment

Hi Eric,

I was doing some exercises on Chapter 9 Classes, and in the exercise 9.9 I was getting this error in the method get_range

UnboundLocalError: local variable 'range' referenced before assignment`

I think this is a variable scope issue, the range variable only available inside the if statement as it's a local variable. Anyway, I was able to get it to work by doing some small changes to the class Battery like this

    def __init__(self, battery_size=40):
        """Initialize the battery's attributes."""
        self.battery_size = battery_size
        self.range = 0

        if self.battery_size == 40:
            self.range = 150
        if self.battery_size == 65:
            self.range = 225
        if self.battery_size == 100:
            self.range = 300
        print(f"This car can go about {self.range} miles on a full charge.")

Please let me know if you have better solution than mine.

Hello world! from Command Prompt Error

Eric, just started on your book Python Crash Course 3rd Edition.

On page 12 about getting Hello world! to work on Windows Command Prompt, when inside the correct directory, I only needed to type the command hello_world, instead of hello_world.py.

About ex_20_4_extended

Hi Eric,

I hope you're doing well. You mentioned that it require a form element on the new_topic page that allows the user to change a topic from private to public. But it wasn't reflected in the repository here. Could you please confirm if this update has been committed?

Thank you very much for your attention to this matter.

alien_invasion: Pressing Q to Quit

While working on the program on page 245, I encountered the following issues:

def _check_keydown_events(self, event):
    """Respond to keypresses."""
    if event.key == pygame.K_RIGHT:
        self.ship.moving_right = True
    elif event.key == pygame.K_LEFT:
        self.ship.moving_left = True
    elif event.key == pygame.K_q:
        sys.exit()

1.When attempting to close the game, it is necessary to switch the keyboard to uppercase mode in order to close the window.

2.If the "q" key is pressed in lowercase mode, it causes the game to become unresponsive to all keys, including the left and right arrow keys. However, after minimizing the window and reopening it, the game becomes responsive again, and it is possible to exit using the uppercase "Q."

I conducted online research and was informed that in Pygame, pygame.K_q represents the "Q" key on the keyboard without distinguishing between uppercase and lowercase. Therefore, I am puzzled as to why this situation is occurring.

pcc_3e/chapter_11 /test_name_function.py differs from text printed in book

The code in the German book version (2023) actually differs from the code provided on GitHub leading to an error when trying pytest Maybe in the next edition of the book the code can be synchronized.

By the way, the book is great and helps a lot even for intermediate python programmers. Thanks a lot!

Error in Anaconda Prompt:
E fixture 'self' not found

Code in German book:
image

pathlib.Path read_text()

In chapter 16 the book used path.read_text() (in 'eq_world_map.py'), when the read_text function now requires a parameter to be passed (encoding=None). In this case, it should be encoding='utf-8' (on my environment). If you don't pass an encoding type, you get this error message:
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 32096: character maps to <undefined>

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.