/r/inventwithpython

7,406 Subscribers

0

Beginner Programmer using Invent Your Own Video Games with Python

beginner programmer here, so I'm having trouble running a simple code that displays "Hello World" on another window when the program running successfully, ive compared it to the book and still nothing i am running it through Pycharm book is Invent Your Own Computer Games With Python (Fig.17-1)pg.257

1 Comment
2024/04/30
05:03 UTC

4

Invent Your Own Computer Games with Python or Making Games with Python & Pygame?

Hello!

I want to learn Python by using either the Invent Your Own Computer Games or the Making Games with Python and Pygame book.

It's not the first time I've learned Python, I learned the very basics in 2014 and 2021. But I've got more experience in Unity and C#. I finished a Unity 2D course in 2022 which covered C#, and so I'd say that I'm confident in the basics of that language (at least for Unity), and I've been practicing that fairly frequently.

Based on that, would I be better off going with the Invent Your Own Computer Games book or should I just jump straight to the Making Games with Python and Pygame book?

2 Comments
2023/12/24
23:07 UTC

3

Google authorization despair

Hi! I've been using EZsheets etc for automating a twice annual reporting process with Google sheets, mail, and drive... which collides into the 180 day expiration of Google authorization keys.

This go around, I've found my efforts to reauthorize -- including creating a new "app" -- foiled in the end by the unhelpful error message:

google.auth.exceptions.RefreshError: ('invalid_grant: Bad Request', {'error': 'invalid_grant', 'error_description': 'Bad Request'})

Any advice on what I can try to get this working? I promise to run the app monthly henceforth to keep my access current. Thanks!

0 Comments
2023/12/21
18:11 UTC

2

Can't find author.com server

Hi, Al. Reading Automate the Boring Stuff. I've tried linking to https://author.com/vampire2, among others. My browser returns a message saying it's unable to find the server. Is there a problem with the site? Thanks.

5 Comments
2023/12/17
23:18 UTC

12

2,000 free sign ups available for the "Automate the Boring Stuff with Python" online course. (Nov 2023)

If you want to learn to code, I've released 2,000 free sign ups for my course following my Automate the Boring Stuff with Python book (each has 1,000 sign ups, use the other one if one is sold out):

https://udemy.com/course/automate/?couponCode=NOV2023FREE

https://udemy.com/course/automate/?couponCode=NOV2023FREE2

If you are reading this after the sign ups are used up, you can always find the first 15 of the course's 50 videos are free on YouTube if you want to preview them. YOU CAN ALSO WATCH THE VIDEOS WITHOUT SIGNING UP FOR THE COURSE. All of the videos on the course webpage have "preview" turned on. Scroll down to find and click "Expand All Sections" and then click the preview link. You won't have access to the forums and other materials, but you can watch the videos.

NOTE: Be sure to BUY the course for $0, and not sign up for Udemy's subscription plan. The subscription plan is free for the first seven days and then they charge you. It's selected by default. If you are on a laptop and can't click the BUY checkbox, try shrinking the browser window. Some have reported it works in mobile view.

Some people in India and South Africa get a "The coupon has exceeded it's maximum possible redemptions" error message. Udemy advises that you contact their support if you have difficulty applying coupon codes, so click here to go to the contact form. If you have a VPN service, try to sign up from a North American or European proxy. Please post in the comments if you're having trouble signing up and what country you're in.

I'm also working on another Udemy course that follows my recent book "Beyond the Basic Stuff with Python". So far I have the first 15 of the planned 56 videos done. You can watch them for free on YouTube.

Frequently Asked Questions: (read this before posting questions)

  • This course is for beginners and assumes no previous programming experience, but the second half is useful for experienced programmers who want to learn about various third-party Python modules.
  • If you don't have time to take the course now, that's fine. Signing up gives you lifetime access so you can work on it at your own pace.
  • This Udemy course covers roughly the same content as the 1st edition book (the book has a little bit more, but all the basics are covered in the online course), which you can read for free online at https://inventwithpython.com
  • The 2nd edition of Automate the Boring Stuff with Python is free online: https://automatetheboringstuff.com/2e/
  • I do plan on updating the Udemy course, but it'll take a while because I have other book projects I'm working on. If you sign up for this Udemy course, you'll get the updated content automatically once I finish it. It won't be a separate course.
  • It's totally fine to start on the first edition and then read the second edition later. I'll be writing a blog post to guide first edition readers to the parts of the second edition they should read.
  • You're not too old to learn to code. You don't need to be "good at math" to be good at coding.
  • Signing up is the first step. Actually finishing the course is the next. :) There are several ways to get/stay motivated. I suggest getting a "gym buddy" to learn with. Check out /r/ProgrammingBuddies
1 Comment
2023/11/05
16:11 UTC

23

2,000 free sign ups available for the "Automate the Boring Stuff with Python" online course. (Oct 2023)

If you want to learn to code, I've released 2,000 free sign ups for my course following my Automate the Boring Stuff with Python book (each has 1,000 sign ups, use the other one if one is sold out):

https://udemy.com/course/automate/?couponCode=OCT2023FREE

https://udemy.com/course/automate/?couponCode=OCT2023FREE2

If you are reading this after the sign ups are used up, you can always find the first 15 of the course's 50 videos are free on YouTube if you want to preview them. YOU CAN ALSO WATCH THE VIDEOS WITHOUT SIGNING UP FOR THE COURSE. All of the videos on the course webpage have "preview" turned on. Scroll down to find and click "Expand All Sections" and then click the preview link. You won't have access to the forums and other materials, but you can watch the videos.

NOTE: Be sure to BUY the course for $0, and not sign up for Udemy's subscription plan. The subscription plan is free for the first seven days and then they charge you. It's selected by default. If you are on a laptop and can't click the BUY checkbox, try shrinking the browser window. Some have reported it works in mobile view.

Some people in India and South Africa get a "The coupon has exceeded it's maximum possible redemptions" error message. Udemy advises that you contact their support if you have difficulty applying coupon codes, so click here to go to the contact form. If you have a VPN service, try to sign up from a North American or European proxy. Please post in the comments if you're having trouble signing up and what country you're in.

I'm also working on another Udemy course that follows my recent book "Beyond the Basic Stuff with Python". So far I have the first 15 of the planned 56 videos done. You can watch them for free on YouTube.

Frequently Asked Questions: (read this before posting questions)

  • This course is for beginners and assumes no previous programming experience, but the second half is useful for experienced programmers who want to learn about various third-party Python modules.
  • If you don't have time to take the course now, that's fine. Signing up gives you lifetime access so you can work on it at your own pace.
  • This Udemy course covers roughly the same content as the 1st edition book (the book has a little bit more, but all the basics are covered in the online course), which you can read for free online at https://inventwithpython.com
  • The 2nd edition of Automate the Boring Stuff with Python is free online: https://automatetheboringstuff.com/2e/
  • I do plan on updating the Udemy course, but it'll take a while because I have other book projects I'm working on. If you sign up for this Udemy course, you'll get the updated content automatically once I finish it. It won't be a separate course.
  • It's totally fine to start on the first edition and then read the second edition later. I'll be writing a blog post to guide first edition readers to the parts of the second edition they should read.
  • You're not too old to learn to code. You don't need to be "good at math" to be good at coding.
  • Signing up is the first step. Actually finishing the course is the next. :) There are several ways to get/stay motivated. I suggest getting a "gym buddy" to learn with. Check out /r/ProgrammingBuddies
12 Comments
2023/10/05
19:03 UTC

1

[HELP] HTTP2 protocol ERROR keeps happening inconsistently when scraping website with Selenium python

I'm going through Automate the boring stuff book and instead of downloading the comic images for the exercise project, I decided to try scraping Sotheby auction site. I've written a script that goes through all the pages on https://sealed.sothebys.com (that have listings of auctioned items), collecting all the items' url, then open each url and download the 1st image of each item.

There are 2 specific points in the execution where the HTTP2 protocol ERROR (this site is unsecure) bug could happen:

  1. When clicking the next button to go to the next page
  2. When opening each auction item's url in a loop

I've isolated just the code for those 2 parts for debugging

I. Clicking the Next Button:

from selenium import webdriver
import time

browser = webdriver.Chrome()
browser.get('https://sealed.sothebys.com')
time.sleep(5)
# click on Next button
n = 0
while True:
    next_button = browser.find_element('css selector', 'button.sc-dd495492-1:nth-child(5)')
    if not next_button.is_enabled():
        print('End of current item on auction catalogue.')
        break
    browser.execute_script("arguments[0].click()", next_button)
    n += 1
    print(n)
    time.sleep(2) 

When this works, it outputs in order: 1 2 'End of current item on auction catalogue.'

(there are only 3 listings pages at this moment)

When it doesn't work, it outputs: 1 <Error message

II. Opening auction items' urls:

I have to remove the https:// part and replace '.' in the url with '_' to avoid issues with posting

from selenium import webdriver
import time

new_items = ['sealed_sothebys_com/YF23/auction', 
         'google_com',
         'sealed_sothebys_com/BC23/auction', 
         'sealed_sothebys_com/michael-jordan/auction', 
         'google_com', 
         'sealed_sothebys_com/the-black-rose/auction', 
         ]

for url in new_items:
browser.get(url)
time.sleep(2)
try:
    item_name_ele = browser.find_element('tag name', 'h3')
except:
        print('Error')

​

60-70% of the time, the error starts happening with the 2nd url and every url afterwards, 30-39% of the time, the first few urls will have no problems (the number of the working urls varies, could be 3 ,5, 10, more than 10 ..) and only 1% of the time or less that 100% of the urls work. Once the error happens with 1 url, all the urls after it will have the error as well. I've inserted 2 google links in the list to test, and they still work fine even if the error happens with the sothebys url right before them.

WHAT I'VE TRIED

  1. I run the code with Firefox driver in the beginning. When the error happened, I thought to try the Chrome driver. It worked with 100% the urls the 1st time I run it with Chromedriver. But from the 2nd time onwards, the error starts showing up with no difference to using Firefox driver.
  2. I tried turning off my antivirus software. Didn't work.
  3. I tried browser.delete_all_cookies() then browser.refresh() when the code encounters error finding element on page. Didn't work. (I did this because if I manually do this on the page opened with selenium: delete cookies and refresh -> the error will disappear, but it will appear again when I click on any link on that page)
  4. I tried adding arguments for Chrome options

​

from selenium.webdriver.chrome.options import Options as ChromeOptions

options = ChromeOptions()
# cloud_options = {}

options.accept_insecure_certs = True
options.add_argument('--ignore-ssl-errors=yes')
options.add_argument('--ignore-certificate-errors')
options.add_argument('--allow-insecure-localhost')
options.add_argument('--allow-running-insecure-content')

# options.set_capability('cloud:options', cloud_options)
browser = webdriver.Chrome(options=options)

The above block of code added before browser.get('https://sealed.sothebys.com') does absolutely nothing. How do I make my code work? I really really appreaciate any help and insights

1 Comment
2023/09/24
00:53 UTC

16

2,000 free sign ups available for the "Automate the Boring Stuff with Python" online course. (September 2023)

If you want to learn to code, I've released 2,000 free sign ups for my course following my Automate the Boring Stuff with Python book (each has 1,000 sign ups, use the other one if one is sold out):

https:// udemy. com/course/automate/?couponCode=SEP2023FREE

https://udemy.com/course/automate/?couponCode=SEP2023FREE2

If you are reading this after the sign ups are used up, you can always find the first 15 of the course's 50 videos are free on YouTube if you want to preview them. YOU CAN ALSO WATCH THE VIDEOS WITHOUT SIGNING UP FOR THE COURSE. All of the videos on the course webpage have "preview" turned on. Scroll down to find and click "Expand All Sections" and then click the preview link. You won't have access to the forums and other materials, but you can watch the videos.

NOTE: Be sure to BUY the course for $0, and not sign up for Udemy's subscription plan. The subscription plan is free for the first seven days and then they charge you. It's selected by default. If you are on a laptop and can't click the BUY checkbox, try shrinking the browser window. Some have reported it works in mobile view.

Some people in India and South Africa get a "The coupon has exceeded it's maximum possible redemptions" error message. Udemy advises that you contact their support if you have difficulty applying coupon codes, so click here to go to the contact form. If you have a VPN service, try to sign up from a North American or European proxy. Please post in the comments if you're having trouble signing up and what country you're in.

I'm also working on another Udemy course that follows my recent book "Beyond the Basic Stuff with Python". So far I have the first 15 of the planned 56 videos done. You can watch them for free on YouTube.

Frequently Asked Questions: (read this before posting questions)

  • This course is for beginners and assumes no previous programming experience, but the second half is useful for experienced programmers who want to learn about various third-party Python modules.
  • If you don't have time to take the course now, that's fine. Signing up gives you lifetime access so you can work on it at your own pace.
  • This Udemy course covers roughly the same content as the 1st edition book (the book has a little bit more, but all the basics are covered in the online course), which you can read for free online at https://inventwithpython.com
  • The 2nd edition of Automate the Boring Stuff with Python is free online: https://automatetheboringstuff.com/2e/
  • I do plan on updating the Udemy course, but it'll take a while because I have other book projects I'm working on. If you sign up for this Udemy course, you'll get the updated content automatically once I finish it. It won't be a separate course.
  • It's totally fine to start on the first edition and then read the second edition later. I'll be writing a blog post to guide first edition readers to the parts of the second edition they should read.
  • You're not too old to learn to code. You don't need to be "good at math" to be good at coding.
  • Signing up is the first step. Actually finishing the course is the next. :) There are several ways to get/stay motivated. I suggest getting a "gym buddy" to learn with. Check out /r/ProgrammingBuddies
10 Comments
2023/09/07
16:29 UTC

13

Learning to Program In An Age of ChatGPT with Al Sweigart

0 Comments
2023/09/06
21:14 UTC

0

Hi all, The pyautogui.locateOnScreen() is not working .... Can you help me?

LocateonScreen() is not working. Whenever I type and press it, the result is none. Can somebody please help?

5 Comments
2023/07/19
20:05 UTC

1

python ETL based project

currently i practice on one dumpy ETL based project.

in this project i used tools such as python, sql server, power BI application.

my doubts are, can i create staging area database and data warehouse database are else company create if incase company create how to find it both of them.

​

and after transfer the data into DW what will do next please share any one our experience like real sceneries. it will help full for my career and skills.

0 Comments
2023/07/19
05:14 UTC

5

My doubt

Hi sir i'm a 8th grade student from india .I just brought your 'automate the boring stuff with python' and I have doubt from it that: Print('what is your age?')#ask for their age myAge=input() Print('you will be '+str(int(myAge)+1)+'in a year.') Page no.17 Here I converted myAge into int() then what's the use of str() here?

2 Comments
2023/07/14
16:07 UTC

3

Chapter 5 - Bouncing DVD Solution

I'm having trouble getting this to work. I've literally downloaded the source files from the website and run that, but I get some version of an error where the x or y coordinate is negative. Any idea why?

File "C:\Python310\lib\site-packages\bext\__init__.py", line 521, in _goto_win32_api

raise BextException('x coordinate is negative')

bext.BextException: x coordinate is negative

​

​

3 Comments
2023/06/21
22:29 UTC

5

[ERRATA] Automate the Boring Stuff 2nd Edition

On page 108:

print('Chance of streak: %s%%' % (numberOfStreaks / 100))

should be:

print('Chance of streak: %s%%' % (numberOfStreaks / 10000))

The full project, showing the percentage found with the simulation and with probability:

import random

numberOfStreaks = 0
for experimentNumber in range(10000):
    # Code that creates a list of 100 'heads' or 'tails' values.
    flips = []
    for i in range(100):
        flips.append(random.randint(0, 1))

    # Code that checks if there is a streak of 6 heads or tails in a row.
    count = 1
    for i in range(1, len(flips)):
        if flips[i] == flips[i - 1]:
            count += 1
        else:
            count = 1

        if count % 6 == 0:
            numberOfStreaks += 1

print('Chance of streak (SIMULATION): %s%%' % (numberOfStreaks / 10000))
print('Chance of streak (MATH): %s%%' % ((1/2)**6 * 100))
4 Comments
2023/06/06
21:02 UTC

3

[ERRATA] Automate the Boring Stuff 2nd Edition

On page 95:

In the first example, the list value that eggs ends up with is the same

list value it started with.

Should be:

In the previous example, the list value that eggs ends up with is the same

list value it started with.

1 Comment
2023/06/02
16:01 UTC

2

[Possible errata] Recursive Book of Recursion, p. 24

In the middle of the page it's written:

The first half is factorial(number - 1). This involves calculating number - 1

and making a recursive function, causing a new frame object to be pushed
to the call stack. This happens before the recursive call is made.

I think this should be something like this:

The first half is factorial(number - 1). This involves calculating number - 1

and making a recursive call to this function, causing a new frame object to be pushed

to the call stack.

Am I misunderstanding it?

4 Comments
2023/05/09
13:57 UTC

4

Coin Flip Streak project in Automate the boring stuff - Is my solution logically correct?

I'm doing projects in Automate the boring stuff. This particular project asks me to Write a program to find out how often a streak of six heads or a streak of six tails comes up in a randomly generated list of heads and tails.

The #comments are hint by the author. This program I created ran just fine but the chance of streak is surprisingly high to me: ~152% - 153%. So I'm wondering if I got the logic right? Any help will be greatly appreciated. Thank you

import random

def flip():
    random_num = random.randint(0, 1)
    if random_num == 1:
        return "H"
    else:
        return 'T'
            
numberOfStreaks = 0 #author wrote this line
for experimentNumber in range(10000): #author wrote this line
# Code that creates a list of 100 'heads' or 'tails' values.

    head_tail_str = ""
    side = flip() 
    head_tail_str += side
    for _ in range(99):
        prev_side = side
        side = flip()
        if side != prev_side:
            head_tail_str += f",{side}"
        else:
            head_tail_str += side

# Code that checks if there is a streak of 6 heads or tails in a row.

    head_tail_lst = head_tail_str.split(',')
    for item in head_tail_lst:
        if len(item) >= 6:
            numberOfStreaks += (int(len(item)) // 6)

print('Chance of streak: %s%%' % (numberOfStreaks / 100)) #author wrote this line

p/s: I've been learning Python for 1 month

2 Comments
2023/05/05
15:42 UTC

28

2,000 free sign ups available for the "Automate the Boring Stuff with Python" online course. (April 2023)

EDIT: The sign ups are all used up. Remember that the Free Preview is enabled for all videos, so you can still watch them all on the course home page. And the first 15 videos are also on YouTube.

If you want to learn to code, I've released 2,000 free sign ups for my course following my Automate the Boring Stuff with Python book (each has 1,000 sign ups, use the other one if one is sold out):

https ://udemy .com/course/automate/?couponCode=APR2023FREE

https ://udemy .com/course/automate/?couponCode=APR2023FREE2

Udemy has changed their promo code and severely limited the number of sign ups I can provide each month, so only sign up if you are reasonably certain you can eventually finish the course. The first 15 of the course's 50 videos are free on YouTube if you want to preview them.

YOU CAN ALSO WATCH THE VIDEOS WITHOUT SIGNING UP FOR THE COURSE. All of the videos on the course webpage have "preview" turned on. Scroll down to find and click "Expand All Sections" and then click the preview link. You won't have access to the forums and other materials, but you can watch the videos.

NOTE: Be sure to BUY the course for $0, and not sign up for Udemy's subscription plan. The subscription plan is free for the first seven days and then they charge you. It's selected by default. If you are on a laptop and can't click the BUY checkbox, try shrinking the browser window. Some have reported it works in mobile view.

Sometimes it takes an hour or so for the code to become active just after I create it, so if it doesn't work, go ahead and try again a while later.

Some people in India and South Africa get a "The coupon has exceeded it's maximum possible redemptions" error message. Udemy advises that you contact their support if you have difficulty applying coupon codes, so click here to go to the contact form. If you have a VPN service, try to sign up from a North American or European proxy.

I'm also working on another Udemy course that follows my recent book "Beyond the Basic Stuff with Python". So far I have the first 15 of the planned 56 videos done. You can watch them for free on YouTube.

Side note: My latest book, Python Programming Exercises Gently Explained is a set of 42 programming exercises for beginners for free or as a 99 cent ebook.

Frequently Asked Questions: (read this before posting questions)

  • This course is for beginners and assumes no previous programming experience, but the second half is useful for experienced programmers who want to learn about various third-party Python modules.
  • If you don't have time to take the course now, that's fine. Signing up gives you lifetime access so you can work on it at your own pace.
  • This Udemy course covers roughly the same content as the 1st edition book (the book has a little bit more, but all the basics are covered in the online course), which you can read for free online at https://inventwithpython.com
  • The 2nd edition of Automate the Boring Stuff with Python is free online: https://automatetheboringstuff.com/2e/
  • I do plan on updating the Udemy course for the second edition, but it'll take a while because I have other book projects I'm working on. If you sign up for this Udemy course, you'll get the updated content automatically once I finish it. It won't be a separate course.
  • It's totally fine to start on the first edition and then read the second edition later. I'll be writing a blog post to guide first edition readers to the parts of the second edition they should read.
  • I wrote a blog post to cover what's new in the second edition
  • You're not too old to learn to code. You don't need to be "good at math" to be good at coding.
  • Signing up is the first step. Actually finishing the course is the next. :) There are several ways to get/stay motivated. I suggest getting a "gym buddy" to learn with. Check out /r/ProgrammingBuddies
7 Comments
2023/04/05
15:00 UTC

8

Mi versión del primer juego de libro

Estoy aprendiendo a programar. Empecé leyendo un libro de introducción a la lógica que usa pseudocódigo y un libro de como escribir mejor código de programación. Estaba impaciente y quería empezar a programar y encontré el libro "Inventa tus propios juegos de computadora con Python 3ra edición" que es una versión traducida del libro de quien creo hizo este blog.

Gracias a los autores del libro y a los que lo tradujeron a español.

Hice mi versión del primer juego del libro para practicar XD.

Los saltos de línea (\n), las cadenas multi-líneas (\) y convertir strings a mayúscula ( upper() ) lo busque en internet para saber como se hace.

Cualquier observación para mejorar es bienvenida.

Saludos.

/*-------------------------------------------*/

I am learning to program. I started by reading an introductory book on logic that uses pseudocode and a book on how to write better programming code. I was impatient and wanted to start programming and I found the book "Invent your own computer games with Python 3rd edition" which is a translated version of the book by who I think made this blog.

Thanks to the authors of the book and to those who translated it into Spanish.

I made my version of the first game of the book to practice XD.

Line breaks (\n), multi-line strings (\) and converting strings to uppercase ( upper() ) look it up on the internet to find out how to do it.

Any observation to improve is welcome.

Greetings.

(Use google translate. Apologies)

​

https://preview.redd.it/j4k8imp1yfga1.png?width=741&format=png&auto=webp&s=dd428ce01d3c9a13971553870bc104dcb6c996a9

1 Comment
2023/02/05
22:01 UTC

1

PyPi Pip Installation

This may or may not be the best place to ask this question, but I recently installed Python 3.11 (latest) and using pip install automateboringstuff2ndedition gives numerous warnings of outdated installer dependencies. It also seems to not like the version of pillow that is outlined from automateboringstuff2ndedition 1.0.3. As an alternative I installed Pillow 9.4.0, but when I reran the 2nd edition pip install, I got a notice that it uninstalled Pillow 9.4.0. As a test then, I went to IDLE for 3.11 and import PIL worked just fine (no errors). Am I missing something? Should the 2nd edition pip installer be used for 3.11?

Pillow error:

RuntimeWarning: Pillow 9.0.0 does not support Python 3.11 and does not provide prebuilt Windows binaries. We do not recommend building from source on Windows.

Deprecation error (note I found this on another install as well, so it may not be 100% accurate to the 2nd edition pip install):

DEPRECATION: future is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 Running setup.py install for future ... done DEPRECATION: pefile is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559

​

0 Comments
2023/01/21
17:25 UTC

3

Made my first Git commit today

2 Comments
2022/12/30
22:47 UTC

3

pyinputplus question

I've gone through the documentation, and don't see how to do this...

Using .inputMenu, is there a way to print (to the console) some sort of prompt to indicate where the user should enter the data? For example:

Make a selection:
1. choice1
2. choice2
>>>

The ">>>" is where the user should input his/her choice.

Thanks.

1 Comment
2022/12/21
13:49 UTC

0

source code for Invent Your Own Computer Games

For the book ( Invent Your Own Computer Games ), Should I pay for the source code, or its free,

if it's free plz I need the URL for the source code

best

1 Comment
2022/11/27
12:53 UTC

2

problem with indentation, python 3

0 Comments
2022/10/29
00:18 UTC

2

Invent with python book hw, unexpected character error

2 Comments
2022/10/07
23:54 UTC

31

2,000 free sign ups available for the "Automate the Boring Stuff with Python" online course. (Oct 2022)

UPDATE: The sign ups have run out. You can still find the first 15 videos of the 50 video course on YouTube for free. Also, check out my new book with programming exercises for beginners for free or as a 99 cent ebook.

If you want to learn to code, I've released 2,000 free sign ups for my course following my Automate the Boring Stuff with Python book (each has 1,000 sign ups, use the other one if one is sold out):

https:// udemy. com/course/automate/?couponCode=OCT2022FREE

https:// udemy. com/course/automate/?couponCode=OCT2022FREE2

Udemy has changed their promo code and severely limited the number of sign ups I can provide each month, so only sign up if you are reasonably certain you can eventually finish the course. The first 15 of the course's 50 videos are free on YouTube if you want to preview them.

Instead of having unlimited free sign ups for 6 days per month, Udemy only lets me make 2,000 free sign ups per month. >:(

NOTE: Be sure to BUY the course for $0, and not sign up for Udemy's subscription plan. The subscription plan is free for the first seven days and then they charge you. It's selected by default. If you are on a laptop and can't click the BUY checkbox, try shrinking the browser window. Some have reported it works in mobile view.

Sometimes it takes an hour or so for the code to become active just after I create it, so if it doesn't work, go ahead and try again a while later.

Some people in India and South Africa get a "The coupon has exceeded it's maximum possible redemptions" error message. Udemy advises that you contact their support if you have difficulty applying coupon codes, so click here to go to the contact form.

I'm also working on another Udemy course that follows my recent book "Beyond the Basic Stuff with Python". So far I have the first 15 of the planned 56 videos done. You can watch them for free on YouTube.

Side note: My latest book, The Big Book of Small Python Projects, is out. It's a collection of short but complete games, animations, simulations, and other programming projects. They're more than code snippets, but also simple enough for beginners/intermediates to read the source code of to figure out how they work. The book is released under a Creative Commons license, so it's free to read online. (I'll be uploading it this week when I get the time.) The projects come from this git repo.

Frequently Asked Questions: (read this before posting questions)

  • This course is for beginners and assumes no previous programming experience, but the second half is useful for experienced programmers who want to learn about various third-party Python modules.
  • If you don't have time to take the course now, that's fine. Signing up gives you lifetime access so you can work on it at your own pace.
  • This Udemy course covers roughly the same content as the 1st edition book (the book has a little bit more, but all the basics are covered in the online course), which you can read for free online at https://inventwithpython.com
  • The 2nd edition of Automate the Boring Stuff with Python is free online: https://automatetheboringstuff.com/2e/
  • I do plan on updating the Udemy course for the second edition, but it'll take a while because I have other book projects I'm working on. If you sign up for this Udemy course, you'll get the updated content automatically once I finish it. It won't be a separate course.
  • It's totally fine to start on the first edition and then read the second edition later. I'll be writing a blog post to guide first edition readers to the parts of the second edition they should read.
  • I wrote a blog post to cover what's new in the second edition
  • You're not too old to learn to code. You don't need to be "good at math" to be good at coding.
  • Signing up is the first step. Actually finishing the course is the next. :) There are several ways to get/stay motivated. I suggest getting a "gym buddy" to learn with. Check out /r/ProgrammingBuddies
1 Comment
2022/10/02
19:48 UTC

39

2,000 free sign ups available for the "Automate the Boring Stuff with Python" online course.

NOTE: The codes are all used up. But you can watch the first 15 of the 50 videos for free on YouTube. If you want to buy the rest of the course, the https://inventwithpython.com/automateudemy link redirects to a discount code that lowers the price to $13. The course follows the info in the book, which is for free in full at https://automatetheboringstuff.com/

If you want to learn to code, I've released 2,000 free sign ups for my course following my Automate the Boring Stuff with Python book (each has 1,000 sign ups, use the other one if one is sold out):

https:// udemy. com/course/automate/?couponCode=SEP2022FREE

https:// udemy. com/course/automate/?couponCode=SEP2022FREE2

Udemy has changed their promo code and severely limited the number of sign ups I can provide each month, so only sign up if you are reasonably certain you can eventually finish the course. The first 15 of the course's 50 videos are free on YouTube if you want to preview them.

Instead of having unlimited free sign ups for 6 days per month, Udemy only lets me make 2,000 free sign ups per month. >:(

NOTE: Be sure to BUY the course for $0, and not sign up for Udemy's subscription plan. The subscription plan is free for the first seven days and then they charge you. It's selected by default. If you are on a laptop and can't click the BUY checkbox, try shrinking the browser window. Some have reported it works in mobile view.

Sometimes it takes an hour or so for the code to become active just after I create it, so if it doesn't work, go ahead and try again a while later.

Some people in India and South Africa get a "The coupon has exceeded it's maximum possible redemptions" error message. Udemy advises that you contact their support if you have difficulty applying coupon codes, so click here to go to the contact form.

I'm also working on another Udemy course that follows my recent book "Beyond the Basic Stuff with Python". So far I have the first 15 of the planned 56 videos done. You can watch them for free on YouTube.

Side note: My latest book, The Big Book of Small Python Projects, is out. It's a collection of short but complete games, animations, simulations, and other programming projects. They're more than code snippets, but also simple enough for beginners/intermediates to read the source code of to figure out how they work. The book is released under a Creative Commons license, so it's free to read online. (I'll be uploading it this week when I get the time.) The projects come from this git repo.

Frequently Asked Questions: (read this before posting questions)

  • This course is for beginners and assumes no previous programming experience, but the second half is useful for experienced programmers who want to learn about various third-party Python modules.
  • If you don't have time to take the course now, that's fine. Signing up gives you lifetime access so you can work on it at your own pace.
  • This Udemy course covers roughly the same content as the 1st edition book (the book has a little bit more, but all the basics are covered in the online course), which you can read for free online at https://inventwithpython.com
  • The 2nd edition of Automate the Boring Stuff with Python is free online: https://automatetheboringstuff.com/2e/
  • I do plan on updating the Udemy course for the second edition, but it'll take a while because I have other book projects I'm working on. If you sign up for this Udemy course, you'll get the updated content automatically once I finish it. It won't be a separate course.
  • It's totally fine to start on the first edition and then read the second edition later. I'll be writing a blog post to guide first edition readers to the parts of the second edition they should read.
  • I wrote a blog post to cover what's new in the second edition
  • You're not too old to learn to code. You don't need to be "good at math" to be good at coding.
  • Signing up is the first step. Actually finishing the course is the next. :) There are several ways to get/stay motivated. I suggest getting a "gym buddy" to learn with. Check out /r/ProgrammingBuddies
3 Comments
2022/09/05
20:09 UTC

5

Question - on pg 60 of "Automate the boring stuff with Python"

Hello!

How do you add an input from the user after importing random? It doesn't seem to work. I want to add it before the code starts:

import random

right here <-------------------------- Where I want to add the str(input()) statement.

def getAnswer(answerNumber):

if answerNumber == 1:

return 'It is certain'

elif answerNumber == 2:

return 'It is decidedly so'

elif answerNumber == 3:

return 'Yes'

elif answerNumber == 4:

return 'Reply hazy try again'

elif answerNumber == 5:

return 'Ask again later'

elif answerNumber == 6:

return 'Concentrate and ask again'

elif answerNumber == 7:

return 'My reply is no'

elif answerNumber == 8:

return 'Outlook not so good'

elif answerNumber == 9:

return 'Very Doubtful'

r = random.randint(1, 9)

fortune = getAnswer(r)

print (fortune)

How do I add the input statement without getting the error:

SyntaxError: invalid syntax ?

4 Comments
2022/08/31
05:52 UTC

Back To Top