Giter VIP home page Giter VIP logo

python-basics-exercises's Issues

Total vote count or win 2 of 3 regions?

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.

Page 325

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."

Page 379

typo in:
>>> daily_tempraturees = []

2023-07 : examples are too old to run with latest editions of Python (3.11.4) and pip packages

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".

Alternative Solution with List (quite similar to Dictionary)

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]}")

Translation to portuguese

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

Possible Issue?

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

sc1

sc2

sc3

Can this be done more efficiently?

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.

Page 374

>>> 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

Page 377

>>> 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

Page 314

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."

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.