15,185 Topics
| |
Hi... I've this: [CODE]random_name = ['Mohamed', 'Ahmed','Aboubakr'] print "1: %s 2: %s 3: %s" % (random_name[1], random_name[0], random_name[2])[/CODE] I want to print all the three names but in random way, as: some time: Mohamed, Ahmed, Aboubaker and some time: Mohamed, Aboubaker, Ahmed and some time: Aboubaker, Ahmed, Mohamed and some … | |
Hi so i created a function that asks users to input their grades for a course and theoretically it should post all of the results and then the grade for the course. I have so far been able to create a function that asks the user for their information and … | |
I want to make a simple editor using wxPython. Complete code is already available in wxPython tutorial page ([url]http://wiki.wxpython.org/WxHowtoSmallEditor[/url]). However, in addition I want to add "print" menu which will print the contents of editor (i.e., whatever written in editor). I will appreciate if someone please show me. Thanks, Akand | |
I'm just trying to come thru with a passing grade at this point because there was no instruction. I can't even get the program that was given to me to work, even though I copied it verbatim from the text. Please help me figure out what the error is so … | |
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 … | |
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. … | |
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 … | |
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 = ['!', ',', … | |
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? | |
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 … | |
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 … |
The End.