• Member Avatar for vegaseat
    vegaseat

    Replied To a Post in If your are a cartoon character, who would you be? why?

    Roadrunner, fast and smart.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in How to specify the path of packages in py2exe?

    I haven't worked with py2exe for a while, but try this ... from distutils.core import setup import py2exe import lxml import gzip import requests import sys sys.argv.append("py2exe") sys.argv.append("-q") setup( console=['Ty.py'], …
  • Member Avatar for vegaseat
    vegaseat

    Marked Solved Status for Python program for prime numbers. can you help me out with continue loop?

    num = int(input("Enter a number: ")) if num==0 or num<0: continue else: if num > 1: if (num % i) == 0: print(num,"is not a prime number") print(i,"times",num//i,"is",num) break else: …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in character frequency table

    For word or character counting use Counter from the Python module collections ... ''' char_frequency_tuple3.py create a list of (char, frequency) tuples using he most_common() method of collections.Counter ''' import …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in character frequency table

    In your code do not use Python function names like **input** for variable names!
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in character frequency table

    import os.path directory = r"C:\Python27\mystuff" # Windows filename = "New.txt" path = os.path.join(directory, filename) # test print(path) # result --> C:\Python27\mystuff\New.txt # then ... with open(path, 'r') as fin: text …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in caesar cipher!

    In general ... mydict = { 'a':'n', 'b':'o', 'c':'p', 'd':'q', 'e':'r', 'f':'s', 'g':'t', 'h':'u', 'i':'v', 'j':'w', 'k':'x', 'l':'y', 'm':'z', 'n':'a', 'o':'b', 'p':'c', 'q':'d', 'r':'e', 's':'f', 't':'g', 'u':'h', 'v':'i', 'w':'j', 'x':'k', …
  • Member Avatar for vegaseat
    vegaseat

    Revoked Solved Status for caesar cipher!

    Hello, I'm trying to script a Caesar cipher with the key, I find this exercise too much for me at this moment! I just can't come up with an algorith …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in is there a python dropdown year selector

    Check ... https://www.daniweb.com/software-development/python/code/488871/year-combobox-python-tkinter
  • Member Avatar for vegaseat
    vegaseat

    Edited Year Combobox (Python Tkinter)

    An example how to use Tkinter's OptionMenu() as a combobox to allow one year to be selected from an option list of let's say the past 15 years.
  • Member Avatar for vegaseat
    vegaseat

    Created Year Combobox (Python Tkinter)

    An example how to use Tkinter's OptionMenu() as a combobox to allow one year to be selected from an option list of let's say the past 15 years.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in returning a string that's 'n' characters long

    Could be as simple as this ... def generate_n_chars(n, ch): return ch * n # test ch = 'z' n = 10 print(generate_n_chars(n, ch)) # result --> zzzzzzzzzz
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A little help with what I thought should be intuitive

    Here we go ... ''' tk_button_run_hello.py run an external Python program via a tkinter button tested with Python3 ''' # replace tkinter with Tkinter in Python2 import tkinter as tk …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Enum Help

    You need to use at least Python version 3.4 ... ''' enum_test101.py module enum is new in Python34 see: http://legacy.python.org/dev/peps/pep-0435/ ''' from enum import Enum class Colour(Enum): WHITE = (255,255,255) …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in not using len() to get length

    You can also apply a recursive function and slicing ... def length(seq, n=0): '''uses recursive function and slicing''' if not seq: return n return length(seq[:-1], n+1) s = "vegaseat" print(length(s)) …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in not using len() to get length

    Even simpler ... def length(seq): n = 0 for c in seq: n += 1 return n s = "vegaseat" print(length(s)) # result --> 8
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Things I hate about TV shows

    The last two episodes of "Bones" were particularly gory. One victim was hit by lightning and they had toast on the examination table. The other victim ended up in a …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Nature's Temper

    Right now it's tumbleweed season. Darn are those things nasty!
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in What are you eating/drinking right now?

    An apple pastry and a mug of Starbucks Holiday Blend.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Jokes

    From the grandkids. What do you call a dog with no legs? Nothing, he won't come anyway.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in The Internet of Things

    The New York City Police Department has a staff of 1000 that looks on the internet at social media like Facebook, Twitter to discover potential threads against the city. (Heard …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Strange program compiles

    See also `__STDC_VERSION__` ... http://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Code Snippet Ideas

    Take a look at ... https://en.wikipedia.org/wiki/Approximations_of_%CF%80 and explore the best way to approximate pi.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in raspberry pi snake

    See also ... http://www.raspberrypi.org/help/what-is-a-raspberry-pi/ http://www.raspberrypi.org/help/faqs/ Note: The Raspberry Pi computer module runs on Linux Debian and does come with python and pygame. It also comes with a bunch of addressable …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in not using len() to get length

    Another option ... s = "abcdefg" for ix, c in enumerate(s): pass length = ix + 1 print(length)
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Memorable Quotations

    "When we fail to invest in children, we have to pay the cost." ... Bob Keeshan
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in do you still do snail mail?

    I can not remember the last time I sent out a handwritten letter. However, I do sent birthday cards with money in them to my nieces, nephews and grandchildren.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in warm or cold?

    If you have plenty of electric energy and airconditioned buildings, then heat above body temperature is not too bad. Do your outdoor activities in the morning when it is usually …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in zork & adventure python script

    A Fortran version of Zork was available in 1975 for the then popular DEC PDP-11 computers. It was later rewritten in C. I think the author of your book wants …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Help!!!

    A tutorial on lists might help ... http://www.tutorialspoint.com/python/python_lists.htm or http://effbot.org/zone/python-list.htm
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Help!!!

    Can you be mildly more specific? Have you started any code?
  • Member Avatar for vegaseat
    vegaseat

    Marked Solved Status for Error with im.putpixel

    Hey, guys! Newbie here. =) I try to reverse an image but an error came and i don't know why :/ This is the error: Traceback (most recent call last): …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in What is the best language to learn?

    I like Python because you can be very innovative and quick when solving problems. My advice, stick with the newer Python3 version. Since the internet is full of Python2 examples, …
  • Member Avatar for vegaseat
    vegaseat

    Edited Prime Number Generator (Python)

    The code shows a fast prime number generator using a sieve algorithm. It looks at only odd numbers. Technically 1 and 2 are prime numbers too, since they are only …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Random Facts

    A "Ten Gallon Hat" does not hold 10 gallons.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in So much info.. what is right?what is wrong?

    Must have gotten lost in my Truth Filter.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Projects for the Beginner

    Integer 197 is called a circular prime because all rotations of the digits 197, 971, and 719, are themselves prime numbers. Create a list of 3 digit primes and find …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Projects for the Beginner

    # a Python code riddle, can you figure it out? print(chr(98) + ''.join (['natural fruit'[:2][int(i==0) : 2+int(i==2)] for i in range(3)])) Can you come up with some of your own …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Starting Python

    Interesting ... """ Misspell1.py The Misspell class takes a string and slightly mangles it by randomly transposing two adjacent characters while leaving the first and last characters intact. The resulting …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Code Snippet Ideas

    Select 6 unique lotto numbers from 1 - 49
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Starting Python

    A little play with lotto numbers ... ''' lotto_list101.py select 6 unique lotto numbers from 1 - 49 ''' import random lotto_list = random.sample(range(1, 50), 6) print(lotto_list) print(sorted(lotto_list)) ''' possible …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Projects for the Beginner

    Write a function to merge a list of lists like [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]] into a single list like [1, 2, 3, 4, 5, …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Projects for the Beginner

    Explore Collatz numbers (the 3n+1 problem, L. Collatz in 1937) http://mathworld.wolfram.com/CollatzProblem.html Take any number, if even divide it by 2, if odd multiply it by 3 and add one, should …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Error with im.putpixel

    A simpler option ... # flip the image around a horizontal axis im_flipped = im.transpose(Image.FLIP_TOP_BOTTOM)
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Python program for prime numbers. can you help me out with continue loop?

    Where is the loop?
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in python program for zig-zag star pattern. how to print the following pattern

    IndentationError: unexpected indent
  • Member Avatar for vegaseat
    vegaseat

    Revoked Solved Status for python program for zig-zag star pattern. how to print the following pattern

    * * * * * * * * * * * * * * * * * * * * * *
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in What are you eating/drinking right now?

    Crudites, garlic hummus, fresh fruit and a glass of diet ginger ale.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Error with im.putpixel

    Use a copy of image im2 = im.copy() Then in the loop try ... im2.putpixel((x, H-y-1),(p[0], p[1], p[2]))
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in There is an elephant on the loo!

    The average human being produces enough saliva in a lifetime to fill a swimming pool.

The End.