15,181 Topics

Member Avatar for
Member Avatar for lukerobi

How would i do this? [code] import random name = random random.name [/code] I dont cant to use name = random.random, as name is something that could change

Member Avatar for lukerobi
0
163
Member Avatar for lrh9

Out of curiosity, how would you reverse a string's case in Python? Make uppercase characters lowercase and lowercase characters uppercase. Here's the function for the naive implementation. [CODE] #!/usr/bin/env python def flip_case(input_string): temp_list = list(input_string) for index, character in enumerate(temp_list): if character.islower(): temp_list[index] = character.upper() else: temp_list[index] = character.lower() output_string …

Member Avatar for lukerobi
0
251
Member Avatar for edificationtube

I am taking a Python programing class at college, but we've haven't done very many complicated things and I want to develop this program for my wife for one of her music classes: A program that takes mp3s with specific titles, artists/composers, and year written/composed, and outputs random 30 sec …

Member Avatar for lukerobi
0
65
Member Avatar for moedoc10

1) Write a function called divisors that takes two natural numbers m and n, and returns a List object containing all natural numbers (starting from m, and going down to 2) by which n is divisible. For example: divisors(6, 6) should return a List object equivalent to List(6, List(3, List(2, …

Member Avatar for lukerobi
0
104
Member Avatar for Judgment

I can't seem to figure out how to make a program that asks for a Start input, End input, and an amount that the program counts by. My request might not be so clear so here's an example: Start at: 1 End at: 20 Count by: 3 1 4 7 …

Member Avatar for vegaseat
-1
268
Member Avatar for akie2741

how can i extact the photo from this website>>[url]http://www.it.usyd.edu.au/about/people/staff/tomc.shtml[/url] ?

Member Avatar for vegaseat
0
173
Member Avatar for willygstyle

Hello all. I been messing around with this port scanner for a while now and can't wrap my head around the speed issue. I tried to create a few threads to help speed it up, but I'm pretty sure I havn't made any progress. Could someone explain why the speed …

Member Avatar for willygstyle
0
151
Member Avatar for Mensa180

Hi all, I can convert my .py or .pyw files into EXE no problem. The thing is they only display a console for about a tenth of a second if they have a GUI made with tkinter. If it is a console only program then the exe works fine. Any …

Member Avatar for Stefano Mtangoo
0
121
Member Avatar for pygirl

Hello, I would really appreciate some help with tkinter. Does anyone know how to change border colour of a widget and if it is possible to display border on just one side of the widget (so for example only the left or bottom border)? I tried to find the answer …

Member Avatar for pygirl
0
1K
Member Avatar for plzhelp

Hi im having trouble with a lab that was assigned today. The program has take input from the user which lights are on button 1 controls the NW and SE hallways, button 2 controls the NE and SW hallways, button 3 controls the SE and NE hallways, and button 4 …

Member Avatar for snippsat
0
84
Member Avatar for nerdagent

I'm trying to put in some code that will delete a list from a list. For example if the user decides to delete the first names he would type in 'first' (w/out quotes). however after they input the name nothing prints out. Any suggestions? [CODE] person = ' ' first …

Member Avatar for vegaseat
0
124
Member Avatar for masterofpuppets

hi currently I am developing a game in python called TankWar, it is basically 1vs1 game style and each player has its own turn. Both players control their respective tanks using the control keys and WASD and they can specify the missile's angle, velocity, tank position. I am using an …

Member Avatar for masterofpuppets
0
190
Member Avatar for vegaseat

Python has some powerful functions, like the math expression evaluator eval(). You can embed this function and others in your Development C++ code. All you need to do, is to download and install the free Python Development Pak and feed the Python code in the form of a string to …

Member Avatar for Shantha.D
1
4K
Member Avatar for james27

hello im currently installed cx_freeze on linux. and want to make win32 exe file on linux by use cx_freeze. and then will distribute on widows platform. one of my problem is ,i can build with no problem. but whenever i run,it something weird error message was show. follow is my …

Member Avatar for james27
0
186
Member Avatar for lewashby

In the program below, how does the value "Poochie" know where to go in the line [CODE]crit = Critter("Poochie")[/CODE] And how do the get_name and set_name functions know when to do their thing, they don't seem to get called or anything? Thanks. [CODE]# Property Critter # Demonstrates get and set …

Member Avatar for Gribouillis
0
736
Member Avatar for masterofpuppets

this is my version of the popular snake game. The snake is controlled by the mouse so be careful when you start :) it grows infinitely long...you should download the apple.jpg file for the game, or graw one of your own just name it apple.jpg and place it in the …

1
349
Member Avatar for manathisbest

i'm a beginner,.. please help! here is the question. [I]Download the [U]TICTACTOE[/U] program. Complete it by writing the cellOpen and the winnerCheck functions. This does not require any changes to the rest of the program. Modify the program so that the two players enter their names (no validation is needed) …

Member Avatar for masterofpuppets
-1
154
Member Avatar for dmcadidas15

I'm having trouble with a program I'm writing and any help would be greatly appreciated. I'm supposed to use an if statement to return an error message if the values entered aren't either the strings 'on' or 'off'. Right now I have [CODE]if (b1 and b2 and b3 and b4 …

Member Avatar for woooee
0
97
Member Avatar for awa

Hi, I want to sort a tuple consisting of two floats and one array by the absolute value of the first float in reverse order. What I did is the following: [CODE]from numpy import * test = [(-0.02, 100.2, array([1, 0, 0])), (-4.02, 300.4, array([1, 1, 0])), (3.57, 503.7, array([1, …

Member Avatar for leegeorg07
0
225
Member Avatar for mahela007

If I do this [CODE]mylist = [1,2,3,4] a = mylist a[0] = 'hello' >>>mylist output : 'hello',2,3,4 [/CODE] I find that the value of mylist has changed to 'hello',2,3,4 So my question is.. If I assign one variable as a value of another (like saying a is mylist), then is …

Member Avatar for jice
0
300
Member Avatar for chico2009

hi I am a complete novice and have written the following code and it work as required, with the exeption of the text being in a tidy format when printed. The origDict.txt has been exported in a fixed file format, and I am trying to acheive a fixed file layout …

Member Avatar for chico2009
0
143
Member Avatar for Dan08

Me and Sravan953 have made a program called Py-Mailer; you all can find it in our first website. Visit [URL="http://h1.ripway.com/dan08/Team_Vaska.html"]http://h1.ripway.com/dan08/Team_Vaska.html[/URL], for more information and to download the program. The program works on Windows, and we are still trying to make it work on Linux. On Windows it's working perfectly and …

Member Avatar for Stefano Mtangoo
0
119
Member Avatar for awa

Hi I was wondering if it is possible to process 2 different files with one function and store the strings/lines I'm searching for in different variables as for instance number1 for file 1 and number 2 for file 2. the code so far: [CODE]import string Name = raw_input("Filename ") infile …

Member Avatar for awa
0
114
Member Avatar for mohfawzy
Member Avatar for woooee
0
34
Member Avatar for lewashby

I'M reading a book on Python and my very first object/constructor program isn't show the output that the book is showing. I lacks the two lines "A new critter has been born!" [CODE]# Constructor Critter # Demonstrates constructors class Critter(object): """A virtual pet""" def _init_(self): print "A new critter has …

Member Avatar for lllllIllIlllI
0
119
Member Avatar for lewashby

In the following code, in the method [CODE]talk(self)[/CODE], [CODE]self.name[/CODE]. What self is self.name referring to? I though variables created in functions and methods are only good within that method or function. But here it looks like it's talking to [CODE]__init__[/CODE] & [CODE]__str__[/CODE]. Can someone please explain? It's starting to get …

Member Avatar for Gribouillis
0
92
Member Avatar for AutoPython

As the title suggests, there are some major flaws in my new program, though it still functions nonetheless. Here's the code: [CODE] POS = 1 try: import Tkinter as tk except ImportError: import tkinter as tk import os def clear(): if os.name == "nt": os.system("cls") else: print ("\n"*40) def key(event): …

Member Avatar for masterofpuppets
0
120
Member Avatar for sravan953

Hey guys, I have made a small program called 'Py-mailer' which allows you to login with your Gmail credentials and send text-only messages to anyone. I uploaded it on SourceForge( [url]http://www.tinyurl.com/m4ans4[/url]). The next step I had to take was to make a GUI for it. So, I started with wxPython: …

Member Avatar for vegaseat
-1
3K
Member Avatar for wajih

Hello all, i want to save the variables present in python workspace to text file.I have used file.write() option but it converts the variables(and also arrays) to string.I want to store them as they are present in IDLE. Is it possible? Thanking all in anticipation. regards wajih

Member Avatar for vegaseat
0
534
Member Avatar for princessotes

Hi, I have a list of positive digits in a file. All I want to do is to add the negative sign (-) to each digit. Is there a code for this. eg list of digits 1 correspond -1 2 correspond-2 3 correspond -3 etc

Member Avatar for vegaseat
0
28K

The End.