Unboundlocalerror Referenced Before Assignment Python Swallows

[Warning: This report contains graphic images]

Experts at the Conservancy of Southwest Florida will soon be publishing an interesting study - one which includes its documentation of a 14.29-kilogram Burmese python swallowing a heavier 15.88-kilogram young white-tailed deer.

According to a statement issued by the organisation, the discovery of the python was made in April 7, 2015 at the Collier-Seminole State Park. The python appeared "distended by a large food bulge."

Wildlife biologists captured the animal for study. Later in captivity, the 11-foot female python became stressed and regurgitated its large meal.

Experts believed the incident to be the largest predator-to-prey ratio ever documented for Burmese pythons, and possibly pythons in general. Additional observations and findings regarding the case will be published in the March 2018 issue of the journal Herpetological Review.

Burmese pythons are snakes native to tropical South and Southeast Asia. They may have entered the United States through the pet trade and were either set loose or escaped from their owners. The pythons are considered an invasive species in southwest Florida where these snakes have negatively affected the area's native wildlife.

Some studies suggest the pythons were 90 per cent responsible for the decline of small animals in the eastern Everglades. Discovering the deer in the python's stomach raised concerns that the snakes could even affect deer population by praying on the young.

Efforts are currently underway to reduce python population by removing female breeding pythons to disrupt the egg-laying cycle and prevent new pythons from being born.

news POST

Purchase this article for republication.

Posts: 2
Threads: 1
Joined: Jan 2018
Reputation: 0
Likes received: 0

#1

Jan-28-2018, 06:25 PM (This post was last modified: Jan-28-2018, 06:30 PM by j.crater. Edited 1 time in total.)
Hi Folks,

I'm currently learning with the edX Introductory course. One of the practice tasks set was to create an A-Z quiz in which you create a function, check_guess(), where the user is asked to input a letter and nudged in the right direction if incorrect. the next task is this:
--

Letter Guess
create letter_guess() function that gives user 3 guesses

takes a letter character argument for the answer letter
  • gets user input for letter guess
    calls check_guess() with answer and guess
    End letter_guess if
    check_guess() equals True, return True
    or after 3 failed attempts, return False
# [ ] create letter_guess() function, call the function to test
--

So, I altered check_guess() to return values-- This is one of several attempts, but I'm stuck:

letter = "p" guess_num = 0 def check_guess(letter, guess): if guess > letter: return("letter is lower") elif guess < letter: return("letter is higher") elif guess == letter: return("correct") else: return('invalid input') def letter_guess(letter, guess, guess_num): guess = input("guess a letter: ").lower() check_guess(letter, guess) if check_guess(letter, guess) == "correct": print("YOU WIN") elif guess_num == 3: print("GAME OVER") else: print(check_guess(letter, guess)) guess_num += 1 letter_guess(letter, guess, guess_num) letter_guess(letter, guess, guess_num) With what I've learnt so far I can't see how to introduce this 3 strikes option into the code. Any pointers would be much appreciated, I'm very new to programming and don't know where to go from here..!

Thanks

0 thoughts on “Unboundlocalerror Referenced Before Assignment Python Swallows

Leave a Reply

Your email address will not be published. Required fields are marked *