15,175 Topics
| |
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 … | |
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, … | |
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++? | |
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 … | |
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 = … | |
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 … | |
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 … | |
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 | |
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 … | |
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 | |
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" … | |
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], … | |
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 … | |
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 … | |
[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: … | |
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 … | |
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): … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
I need to modify this code to promt the user for a word and display how many times the word appeared in the input file. class HashTable( object ): """A data structure that contains a collection of values where each value is located by a hashable key. No two values … | |
I am currently working on my first serious GUI application in python using Tkinter. I currently have a toplevel window that opens from the root window. when i envoke the window from the root i can see all 7 of my other widgets, but the widget: btncancel = Tkinter.Button(addboard, text … | |
Hi, I was pondering this earlier and wasn't sure if it was possible. Say, for example you had 2 objects; [B]spam[/B] and [B]eggs[/B], and you wanted to create a function to change attributes - e.g. colour. So spam.colour = 'Blue' and eggs.colour = 'Green'. How would you change that attribute … | |
Hi All i have downloaded following code from web that inputs sound samples and displays spectrum, i want to print frequencies present in each second in the spectrum.i.e when ever the spectrum is displayed i want to print those frequencies as well on the console. Below is the code i … | |
hello friends i have just completed the python reading from book called "how to think like a computer scientist Python" ..Now i want to dive for Django framework for web development is that book(how to think....)is enough or should i polish my python skills first.....Please note that i have no … | |
I was told that there are four python string delimiters but I can only think of three, ', ", & """. What is that last one? I searched google but with no luck. |
The End.