- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 29
- Posts with Upvotes
- 24
- Upvoting Members
- 16
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
The idea of this thread is to help the beginning Python programmer with hints and helpful code. Please feel free to contribute! If you have any questions start your own thread! The creators of Python are very active, improving the language all the time. Here is a little of the … |
|
After you got the basics of Python under your belt, the best way to get a good knowledge of the language and improve your coding skills is to start on a project you are interested in. Maybe an image viewer, a slide show, computer generated random or fractal art, a … |
|
How do you rest your variable everytime your execute the program. [code]for x in range(1,100): running = True while running: guess = int(raw_input("Enter an integer:")) if guess == x: print "Nice" running = False if guess < x: print "Higher" running = True if guess > x: print "Lower" running … |
|
I was trying to come up with a dictionary of functions, but get it not to work. |
|
Hello, I'm learning Python. It is my first interpreted language. I have some experience with C and C++. I must admit that it's very hard for me to accept a concept of interpreted language. For example I write code in C++, compile it, link it and I have .exe file … |
|
1. .......Algorithm to find the first n Hardy-Ramanujan numbers.... since 1729 is the least ..... I request to post the solution for this............ |
|
Hi guys, I'm trying to learn the principles of artificial intelligence. I just finished coding up a belief net and a corresponding EM algorithm that learns the CPTs for latent nodes using training data (if you're unfamiliar with the lingo, you're probably going :eek: right now). While the program (written … |
|
Here's something of mine that might actually be useful: a Python implementation of the K-means clustering algorithm. I wrote something similar last year in Java for a school project, and decided to rewrite it in Python this summer for practice. The purpose of the algorithm is to discover internal structure … |
|
This is my first experience with Python's Tkinter GUI. I want to write a program where the result of an interim calculation is displayed on a label. Later in the program I want to use this result in another calculation by simply clicking on the label. This is what I … |
|
I do have a problem with my connect four code ; it doesn't check whether there is a winner even though the function its okay :-/ Can anyone help me to solve my problem ??? [CODE=python] import random board = dict() rows,columns = 4,4 def game(): choose_player() #MAKE BOARD FUNCTION … |
|
Hello everyone! I want to use bash from python, however the os.system([I]command[/I]) seems to act only on one command at a time. I want to use complete commands, also containing control flow statements, like If and While, and to call them from python. something like this code in bash: T1="foo" … |
|
Hi all, Have you ever heard of "Petals Around the Rose?" It's a logic puzzle. The way it works is, I roll five dice, then tell you what the "score" is for this round. I can repeat this for you as many times as you want. It's your job to … |
|
[URL="http://www.bitstorm.org/gameoflife/"]Life[/URL] is a "game" or cellular automaton - an evolving computational state system - developed by a Cambridge mathematician named John Conway. The idea is simple: start with a board of dimensions (x,y). Populate the board with an initial pattern of occupied and empty cells. In every turn, the rules … |
|
Suppose you are a medical researcher studying diabetes. Your boss has given you a big chart of data from diabetes patients. Each row of the chart has information for one patient. Each column of the chart is a health-related statistic, such as height, weight, age, blood pressure, cholesterol level, etc. … |
|
Here's a cute little encipher/decipher program with a Tkinter GUI I wrote a while back. It's an implementation of a derivative of the Vigenere algorithm; the algorithm is taken from Laurence Smith's Cryptography: The Science of Secret Writing, Amazon link here. It's a dated book (and the technique itself is … |
|
i've made a little animation using python and the pygame module, I'm just wondering if it's possible to turn that into a screensaver? is there a format i have to save it to? If anyone knows i would be grateful for the solution thanks, a1eio |
|
So this should be a really easy one, but i've spent a few hours searching and can't find anything that explicitly states how to do this. All i want to do is see the column names for a particular table. I created the tables like: [CODE=python] con = sqlite3.connect( ":memory:" … |
|
so i have to write regression line program which is hard enough seeing as i just started so i need help, 1st thing is how do i write a loop for mouse clicks of any number, then write the average of whatever the amount of mouseclicks, thanks! |
|
Hi im new to this board. Im beginning a new Python prject, my last one was a html GUI which I built in Tkinter. This time im going to make a AIM bot. Any idea on where to start with a project such as this. All help is appreciated! Thanks |
|
So, I wrote a little script to convert tifs into jpegs. The tifs are about 600mb in size, I reduce the size, and then convert. Here is the code in its entirety: [code=python] ## First we import the image library, Image object, and garbage ## collector, as well as os … |
|
Hopefully this question is easier than I think it is. :) I have a directory with thousands and thousands of flv and jpeg files in it. I want to loop through the directory, get the file names and their sizes (in bytes) I've tried searching the web for a function … |
|
Hello, I am fairly new to Python and starting to get it. But I am having some difficulty with pickle. I am trying to get a account program to pickle user input and to save that in a data file and then reload said info and read as input for … |
|
Is there any way for someone to, using PyGame or SDL, to do, say: [code]00000000 01222100 01112110 01112110 01111110 00000000[/code] And have it display the 0's as a water tile (10x10), the 1's as a grass tile (10x10), and the 2's as a rock tile (10x10)? As to make maps … |
|
Hi all, I add a pygame implementation of the Game of Life to the Code Snippets section. I was actually kind of surprised that we didn't already have one in there! The program only has about 60 lines of code, but I buttressed that with a lot of comments and … |
|
hi everyone.....i'm designing a simulator and i need to study John Conway's Game of Life. i'm getting the source code in java or c++ everywhere i search. Have anyone ever implement it using python or can you please give me a link where i can find the source code in … |
|
Hi all, Are there any python modules which contain functions for getting the roots of a quartic (degree 4) polynomial? I don't think NumPy has anything like it, and I [I]really[/I] don't want to enter the equations in by hand. Thanks. |
|
Can anybody tell me how can i avoid the overflow of this program? from math import sqrt f=lambda n: sum([int(i)*int(i) for i in str(n)]) L=[] for n in range(0,10**20): if sqrt(f(n))%1==0:# == float(int(sqrt(f(n)))): L.append(n) L.sort() print "NĂºmero de quadrados perfeitos na lista:",len(L) print L y= lambda L: reduce(lambda x,y: x+y,L) … |
|
I am working to increment lists in such a way that each item in the list is incremented incrementally, it sounds confusing but its not: If the user inputs: [CODE]list = [1, 2, 3, 4] [/CODE] I want the output to be: [CODE]2, 4, 6, 8[/CODE] in essence, the first … |
|
Hi Guys, I have a nested dictionary that i would like to be populated from a file at the start of my prog and put back into the file at the end of the prog. Could anyone direct me to somewhere where i could get info on how to do … |
|
Hi, I've got about 10 functions that all share a bit of code. They all look something like this: [code=python] def func(arg): statement1 statement2 statement3 unique code statement4 statement5 [/code] Each function does similar statements at the beginning and end, but has unique stuff in the middle. Is there a … |