ehmatthes / pcc_3e Goto Github PK
View Code? Open in Web Editor NEWOnline resources for Python Crash Course, 3rd edition, from No Starch Press.
Online resources for Python Crash Course, 3rd edition, from No Starch Press.
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.
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.
Error while running python mpl_squares.py
at Page 302 on raspberry pi.
Following error: ImportError: libopenblas.so.0: cannot open shared object file: No such file or directory
Found this reference:
https://numpy.org/devdocs/user/troubleshooting-importerror.html#raspberry-pi
Tried both the options mentioned in above reference, none worked. Please guide.
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>
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.
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.