15,181 Topics

Member Avatar for
Member Avatar for joywheels

Hi everyone, I am going through a self-paced class for Python beginners and have ran into a dictionary problem that I can't figure out. I'm creating a set of words from user input. Then send those words to a dictionary that adds a key for when the word is first …

Member Avatar for TrustyTony
0
130
Member Avatar for blenkhn

I have been trying to no avail to load a ui file and insert it into a tabWidget as a new tab. I commented out a try that I thought would work, I was wrong. I have tried several different ways but I always seem to get the same error. …

Member Avatar for blenkhn
0
885
Member Avatar for zizuno

I may have phrased the title wrong but it is what I mean. I am not looking for multiple windows at once, I am writing a script that opens a tkinter window asking for information etc etc etc and it all saves into a database after the last window. Right …

Member Avatar for TrustyTony
0
665
Member Avatar for pythonn00b

Implement a function punctuation() that takes no parameters, inputs a string from the user, and prints all of the punctuation characters appearing in the string, in order from left to right. My coding I have so far is: def punctuation(): a = raw_input("Please enter a string:") check = ['!', ',', …

Member Avatar for snippsat
0
378
Member Avatar for benqb

Iam using [color=#FF0040]import paketlogic2[/color] in my project when i hosted that project in webserver i got the following error [color=#FF4000]Couldn't connect to PacketLogic: cannot import name PLv11[/color] why?

0
49
Member Avatar for aint

Hi, I have many files made by a software. I want to extract some data from those files, and when I open the file with textedit, I see that what i need is on the first line. i have many of these files, and when I run the script, it …

Member Avatar for aint
0
133
Member Avatar for blagoblg

Hi. I want to draw something like graph in 3D. I wrote this for its points (vertices):[CODE]import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np fig = plt.figure() ax = Axes3D(fig) ax.scatter([3,4,4,4,3,2,2,2], [3,3,3,4,4,4,5,5], [3,3,2,2,2,2,2,1],s=150, c='r') ax.set_xlim3d(1, 5) ax.set_ylim3d(1, 5) ax.set_zlim3d(1, 5) plt.show()[/CODE] , but I don't know …

0
45
Member Avatar for benqb

In my phpcode [CODE=php] <?php $out = array(); $execute='./test.py'; $name = "?key=1234&path=host"; exec ("$execute $name", $out); foreach ($out as $value) { echo "$value<br />\n"; } ?>[/CODE] In test.py file i want to get the value corresponding to path that is host In test.py [CODE] #!c:/Python27/python.exe -u import django import cgi, …

0
61
Member Avatar for WildBamaBoy

I'm at a point with this program that I need to do a lot of work with strings. This would be so much simpler to do in Python, however I don't want the entire program written in Python. How could I use functions from a Python script in C++?

Member Avatar for WildBamaBoy
0
258
Member Avatar for jamd200

This program allows one to use many different sorting algorithms to sort an iterable. [code=python] from time import* from random import* #GNOME SORT def gnome_sort(lst): pos = 1 while pos < len(lst): if lst[pos] >= lst[pos-1]: pos = pos+1 else: temp = lst[pos] lst[pos] = lst[pos-1] lst[pos-1] = temp if …

Member Avatar for jamd200
0
340
Member Avatar for jamd200

I coded a simple tic-tac-toe "from scratch" (haven't included a GUI or anything of that sophistication). I would like to know about any improvements that can be made to this game. Thank you. [code=python] import random board_lst = [] class board: def __init__(self, rows, columns): self.rows = rows self.columns = …

Member Avatar for jamd200
0
229
Member Avatar for jamd200

So far, my simple numerical analysis program has differentiation, integration, first-order ODEs and Taylor Series. What else can I add to this? [code=python] from math import* """Single-variable calculus.""" #DIFFERENTIATION def gen_differentiation(f,x,h): #finds the first derivative of any mathematical function return (f(x+h)-f(x))/(h) def special_differentiation(f,x): #finds the first derivative of specific functions …

Member Avatar for jamd200
0
160
Member Avatar for benqb

I am executing python file through php code in my local host [CODE=php]<?php $out = array(); $execute='C:\wamp\bin\apache\Apache2.2.11\cgi-bin\test.py'; exec ("$execute", $out); foreach ($out as $value) { echo "$value<br />\n"; } ?>[/CODE] test.py [CODE=python] #!/usr/bin/python import cgi, cgitb, os, sys cgitb.enable(); # formats errors in HTML print "helloworld"[/CODE] it correctly working in …

Member Avatar for jkon
0
94
Member Avatar for kitjo

Am teaching it to my self but i have found many problems. i need your help because i want to build a dictionary for my local language. the words i already havee them and i only need the codes forlinking to the database and extraction from the database

Member Avatar for jordan0420
0
182
Member Avatar for Tech B

This is a facial recognition system. Supports one face so far. This is an example ported from C++ to python. To see the original and to obtain the dll used visit [URL="http://www.kyb.mpg.de/bs/people/kienzle/facedemo/facedemo.htm"]this site.[/URL] I do not take credit of the dll, only the ported python code. The comments in the …

Member Avatar for Tstrv
1
648
Member Avatar for benqb

I am passing the given query [url]http://localhost:8080/show?key=1234&path=host[/url] in my python script i want to take the 'path' only how can i get it? i use [CODE] def get(self): data = self.request.get('path') [/CODE] but it not working

Member Avatar for GDICommander
0
226
Member Avatar for blagoblg

Hi I have a problem with installation of numpy ! I followed the instructions from the page of scipy and tried sudo apt-get install python-numpy python-scipy too. It shows this message: [CODE]blago@blago-laptop:~$ python Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" …

Member Avatar for GDICommander
0
432
Member Avatar for basketball8533

Hey guys can you help me convert this code into java... i started a little... [CODE] def minEditDistR(target, source): """ Minimum edit distance. Straight from the recurrence. """ i = len(target); j = len(source) if i == 0: return j elif j == 0: return i return(min(minEditDistR(target[:i-1],source)+1, minEditDistR(target, source[:j-1])+1, minEditDistR(target[:i-1], …

Member Avatar for DarkLightning7
0
183
Member Avatar for unrealj

For my project, as others before have noted, I have to create a hashtable using chaining. I rewrote my Get and Put functions, but I do not know how to change the Locate Function. Here is the code [CODE]def hash_function( val, n ): """Compute a hash of the val string …

Member Avatar for unrealj
0
362
Member Avatar for jordan0420

am adding a GUI into a python database and i was wondering if there is any way for text to be already in an entry box when it appears. The window is for adding movies to the database so i would like the following, please enter the movies title: [Title …

Member Avatar for TrustyTony
0
2K
Member Avatar for DecreaseEntropy

[code] # nth_prime.py def nth_prime(n): primes = [2] test_int = 1 while len(primes) < n: test_int += 2 for p in primes: if test_int % p is 0: break else: if p is primes[len(primes)]: primes.add(test_int) return primes[n - 1] while True: try: num = int(input("Enter a number:\n")) print(nth_prime(num)) except ValueError: …

Member Avatar for woooee
0
234
Member Avatar for basketball8533

Hey guys can you help me convert this code into java... i started a little... [CODE] def minEditDistR(target, source): """ Minimum edit distance. Straight from the recurrence. """ i = len(target); j = len(source) if i == 0: return j elif j == 0: return i …

Member Avatar for DecreaseEntropy
0
148
Member Avatar for Hawkeye Python

Hi! The following Tkinter buttons should call [I]opt_def[/I] with [I]opt[/I] as 1 or 2 depending on which button is pressed (see code). [CODE]from Tkinter import * class App: def __init__(self, master): frame = Frame(master) frame.pack() self.opt1 = Button(frame, text="Opt1", command=self.opt_def(1)) self.opt1.pack(side=TOP) self.opt2 = Button(frame, text="Opt2", command=self.opt_def(2)) self.opt2.pack(side=BOTTOM) def opt_def(self, opt): …

Member Avatar for Hawkeye Python
0
3K
Member Avatar for owilliam

Chances are this is a dumb question, but hey, I don't have anywhere else to go. I wrote a basic hangingman game on my pc desktop using a paint event to draw the hangman. Unfortunately, this code doesn't seem to run the same on my new apple computer. It comes …

Member Avatar for richieking
0
104
Member Avatar for owilliam

I've put together a code to make a periodic table with jpeg bitmap buttons, and here's the code: [code] element_list = ["H.jpg","He.jpg","Li.jpg"] for i in range(len(element_list)): image_id = int(i+1) image_current = wx.Image("/Applications/PeriodicTable/ButtonBitMap/%s" % element_list[i], wx.BITMAP_TYPE_ANY).ConvertToBitmap() current = wx.BitmapButton(self,id=image_id,bitmap=image_current,style=wx.BORDER_NONE) main.Add(current,1) [/CODE] I've done the id, because for some reason, I can't …

Member Avatar for richieking
0
95
Member Avatar for everydaybh

Hi, I'm going through Zelle's Python Book, and for the graphics chapter, I have some problems (using pycharm): I type in from graphics import * win=Graphwin() and it shows me a window when I run it, with a background triangle and says 'centered text' in the middle - and no …

0
50
Member Avatar for da10x

Hello people, I have an assignment to do and I have no idea how to do it. First: I have to modify this program to prompt the use for a word and display how many times that word appeared in the input file. When the user hits RETURN, the program …

Member Avatar for dynaflex
0
191
Member Avatar for newbieha

How to modify the hash table implementation to use chaining instead of open addressing? [CODE]class HashTable( object ): """A data structure that contains a collection of values where each value is located by a hashable key. No two values may have the same key, but more than one key may …

Member Avatar for newbieha
0
2K
Member Avatar for ShadyTyrant

I am trying to optimize some code I have written. I do not wish to add 0 to my list if it is already set to zero. So it only needs to be changed if the letters or words do not match. Here is the working code (You will also …

Member Avatar for ShadyTyrant
0
558
Member Avatar for dynaflex

I need to write a program that implements this algorithm. create a hash table. for each word in words.txt sort the letters in word and use that as a key enter the(key, word) pair into the hash table prompt the user for a string while the string s not empty …

Member Avatar for TrustyTony
0
97

The End.