realpython / python-basics-exercises Goto Github PK
View Code? Open in Web Editor NEWPython Basics: A Practical Introduction to Python 3
Home Page: https://realpython.com/pybasics-book
Python Basics: A Practical Introduction to Python 3
Home Page: https://realpython.com/pybasics-book
In reading the exercise, the winner has to win 2 of 3 regions. This code seems to count wins as total vote counts across all regions. So the exercise was to do an electoral college kind of win, but your solution is counting the popular vote. Am I misinterpreting your code? Thanks, love the book and the exercises.
Sorry, I did not see the 9b-challenge-simulate-an-election.py
Original Text
However, deeply nested subpackages introduce long dotted module names. You can image how much typing it would take to import a module from a subpackage of a subpackage of a subpackage of a package.
Suggested Edit
However, deeply nested subpackages introduce long dotted module names. You can imagine how much typing it would take to import a module from a subpackage of a subpackage of a subpackage of a package.
The word "imagine" was misspelled as "image."
typo in:
>>> daily_tempraturees = []
As of July 2023, the example code is too old to run with the latest editions of Python (3.11.4) and packages (e.g., pypdf).
Symptoms include (but are not limited to) deprecation warnings almost immediately when trying the code such as 2-example-app-pdf-page-rotator
that make it next to impossible to run the examples.
I will totally understand if there is no cost/benefit to you to upgrade the examples from four years ago (according to GitHub). I'll just not buy the products or services associated with Real Python and seek other ways to educate myself and save myself the investment in "dead code".
Hi,
in the solution file ch09-lists-tuples-and-dictionaries/6-store-relationships-in-dictionaries.py is typo in Bonus part of Exercise 3
for name in ["Enterprise", "Discovery"]:
should be
for ship in ["Enterprise", "Discovery"]:
Cheers,
-Lex
Quite short with two nested for loops:
cat_count = 100
cats = [False for i in range(cat_count)]
for step in range(0, cat_count):
for selected_cat_index in range(step, cat_count,step + 1 ):
cats[selected_cat_index] = not cats[selected_cat_index]
for i in range(cat_count):
if cats[i]:
print(f"Cat {i+1}: {cats[i]}")
in file 3-manipulate-strings-with-methods
line30 should be print(string2.strip()) ?
Hello, I'm interested in translating some exercises to portuguese. A lot of people here in Brazil are interested in practicing with these exercises, so this could make it more accessible for those people.
Thanks
Hello, I'm going through the Python Basic book and going through the excersises and I've come across a possible code error in the PDF page 85, question 5. The solutions to exercises shows the solution, but when entered it doesn't show as True as the instructions says. I've already tried the solution on both Python 2 and Python 3 and no luck. Can someone, please advise?
Github: ch04-strings-and-string-methods/3-manipulate-strings-with-methods.py
Python Basic book PDF: Pg: 85, Question 5
I notice you doing the same thing repeatedly for nouns, verbs, and adjectives. Would a for loop work here to loop through a range (3) for items in noun, verb, adjective? I can't figure out how to do it though.
>>> file_path = Path.home() / "temperatures.txt"
but in page 375 says:
This creates a file called temperatures.csv in your home directory andopens it in append mode.
Obviously it creates temperature.txt not temperature.csv
>>> file = file_path.open(mode="w", encoding="utf-8")
Now create a new CSV writer object by passing the file object file to csv.writer():
>>> writer = csv.writer()
You did not passed the file created earlier and running the code by just looking to the code provided, results in error:
TypeError: expected at least 1 argument, got 0
Original Text
Don’t worry about how the datetime class works right now. The important part of this example is that having to constantly time datetime.datetime anytime you want to use the datetime class is redundant and tiring.
Suggested Edit
Don’t worry about how the datetime class works right now. The important part of this example is that having to constantly type datetime.datetime anytime you want to use the datetime class is redundant and tiring.
The word "type" was misspelled as "time."
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.