15,181 Topics

Member Avatar for
Member Avatar for python-noob

I created a program awhile back to translate a phrase into pig latin. Pretty simple program, but now I am trying to figure out how to get it to read from a file and process it that way. Here is my old program; [CODE] def main(): enter = raw_input("Enter a …

Member Avatar for python-noob
0
428
Member Avatar for pythoner

im trying to make a simple calculator: [CODE] loop = 1 while loop == 1: print "Welcome to Jakes' Calculator" print "1) addition" print "3) multiplication" choice = raw_input("Enter a number 1-4: ") break if choice.strip() == "1": a = input("enter the first number: ") b = input("enter the second …

Member Avatar for pythoner
0
178
Member Avatar for Netcode

Hello pythonistas, am still some months new to python and i've decided to go with the web2py framework. I love its simplicity but unfortunately, it lacks study resources. The only available book i could get was the official book written by MASSIMO DI PIERRO. id be greatly appreciated if i …

Member Avatar for Netcode
0
101
Member Avatar for nickecarlo

Hey, Is there a way, by using find, to create a method that finds the last occurrence of a character in a string? I know how to use the find method to find the first occurrence but have no idea how to do it backwards. Basically this is what I …

Member Avatar for nickecarlo
0
140
Member Avatar for straylight

Not sure if it is possible but is there a way to multiply,add,or subtract values in a tuple? Say for example I have: [CODE] a=raw_input("enter 2 numbers separated by a /: ") #5/2 entered b=a.split("/") c=a[0]+a[1] print c [/CODE] The value comes out to 52 which is obviously wrong. Is …

Member Avatar for straylight
0
347
Member Avatar for minimee120

Hi all. I am having trouble with one of midterm practice problem questions again. I need to be able to get the First, Middle, and Last Name using the count function. However, my professor wants us to be using a name with more than one middle name, and I am …

Member Avatar for minimee120
0
245
Member Avatar for markusd5454

Please provide a pseudocode algorithm for this question please. Please do the pseudocode for Python 3.2.2 Write a program which asks the user to enter a username, and then a password. Then when they type the command “log off”, they will have to retype their username and password in order …

Member Avatar for TrustyTony
0
155
Member Avatar for JOSED10S

printBoard: A call to this function with printBoard(5,4,[1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]) would print the following output to standard output: |-----------| | 1 0 0 1 0 | | 0 0 0 0 0 | | 0 0 0 0 0 | | 0 0 0 0 0 | |-----------| def board(l,h,list): %a length, …

Member Avatar for JOSED10S
0
201
Member Avatar for Tadmir

So I have a number of CSV files with 6 columns of numbers in each file. I would like to perform a few operations (multiplication, division etc.) on each column in each of the CSV files using Python and instead of opening each file manually, I want to add the …

Member Avatar for TrustyTony
0
2K
Member Avatar for markusd5454

Write a program which asks the user to enter a username, and then a password. Then when they type the command “log off”, they will have to retype their username and password in order to log back on again. Please note i am using python 3.2.2. Regards Mark

Member Avatar for ihatehippies
0
81
Member Avatar for moroccanplaya
Member Avatar for moroccanplaya
0
1K
Member Avatar for roe1and

Hi. I am a beginner with Python. I've done some PHP work in the past but I suspect this is not helping with my progress in Python. I have a text file that basically looks like this: [CODE]a=1 b=2 c=3 a=4 b=5 c=6 a=7 c=8 a=9 b=0 c=11[/CODE] At the …

Member Avatar for roe1and
0
305
Member Avatar for Jetster3220

I am really struggling with a Python classes project. Here are the directions Design and implement a class called Dog that contains attributes (data) representing the dog’s name and age. Define the Dog constructor to accept and initialize that data. Include one method that will reset the dog’s age, one …

Member Avatar for Gribouillis
0
229
Member Avatar for straylight

So I have been working on Pascal's triangle and going about it a different way then most. I am attempting do to a series of if and elif statements to check for the values in rows and columns of those rows. However my novice skills in python are stopping me …

Member Avatar for straylight
0
236
Member Avatar for KickAssElmo

Please tell me what I'm doing wrong. I have a list, and I want python to make a file out of it. [CODE]def changename(filename, modifier): return filename[:4]+modifier+filename[-4:][/CODE] [CODE]def fileWrite(filename, ext, sortedList): openthis =open(okfilename(changename(filename,'_'+ext)),'wb') for item in sortedList: openthis.write(item) openthis.write('\n') return[/CODE] [CODE]lastnames.append(newNames) lastnames.sort() print '\n'.join(lastnames) names.close() fileWrite(filename, "Last-sorted", lastnames)[/CODE]

Member Avatar for KickAssElmo
0
231
Member Avatar for Yoink

I have to write a program that will decode a Ceasar cypher with any possible rotation length on a long string that will be imported into the program. I'm trying to figure out some pseudo coding on how I want to tackle this problem but there is one key thing …

Member Avatar for TrustyTony
0
350
Member Avatar for SnehalBPatil

I am developing the Django application which runs the Matlab code and create some txt and png files on the server.when I run these below python command on server, it works fine but when I try to run from the server (it is coded in Viewspy).It shows file is updated.(from …

0
173
Member Avatar for jxj123

hi, my code involves something like this: [I]IP = "123.123.123.123" string = "Your IP is %s and it's 100% correct" % IP[/I] The IDLE thinks the second % is a operator and I don't know how to make it as a regular text. please help.

Member Avatar for jxj123
0
96
Member Avatar for HoneyBadger

Guys I have this string: [CODE]mystring = 'blue, pink, red, red, red, white, long, short, blonde, blonde'[/CODE] I want to: 1.) Split it into a list, 2.) Erase all duplicates 3.) Sort it out alphabetically so I did this: [CODE]mystring = list(set(mystring.split(', '))).sort()[/CODE] But why when I go to call …

Member Avatar for HoneyBadger
0
123
Member Avatar for HoneyBadger

Guys I'm looking for a clean way of splitting a string into a list: I have this: [CODE]myString = 'blue, red, pink, purple'[/CODE] and I want this: [CODE]myString = ['blue', 'red', 'pink', 'purple'][/CODE] How do I do that?

Member Avatar for HoneyBadger
0
154
Member Avatar for layneb131

Im trying to write a program that inputs a single letter and prints out the corresponding digit on the telephone. Im having trouble finding out a way in which you can group the variables that have the same digit, but im not sure how. You guys have any suggestions? P.S. …

Member Avatar for woooee
0
483
Member Avatar for ohblahitsme

So I have a function called start() and it has multiple if statements and I want all of them to run. [code=python] def start(): print """You have just woken up from a very long nap. You find yourself in a dimly lit cave. There is a patch of light in …

Member Avatar for woooee
0
281
Member Avatar for dineshswamy

[CODE] a = input("enter the string") print "%s dinesh" %l m=re.match(r'(.*)(\.*)',l,re.I) print m.group() print m.group(2) [/CODE] i m getting the following error ,when i give input [CODE] Traceback (most recent call last): File "regularexp.py", line 1, in <module> a = input("enter the string") File "<string>", line 1, in <module> NameError: …

Member Avatar for dineshswamy
0
133
Member Avatar for floatingshed

With a lot of help from ihatehippies I got threads working yesterday. Now I need to stop 'em! More specifically I want to stop a second thread starting until the first has finished.. This is what I have in my threading class at the moment: [CODE]class ProcessThread(Thread): """Test Worker Thread …

Member Avatar for floatingshed
0
372
Member Avatar for darsha

[QUOTE]i am trying to implement a fitness function for GA. i got a code written in python. i don't have any idea about python. can someone help me to convert it into java the code is here [/QUOTE] [CODE]# there are many ways to do an eigenvalue decomp, this is …

Member Avatar for FALL3N
0
568
Member Avatar for theLured

Hello, I'm a python beginner and glad I joined this forum :). I'm wanting to make a simple program where the window is hidden for x seconds/minutes and is then shown again. My problem is that using time.sleep() causes the Hide() function to not run until after time.sleep() is complete. …

Member Avatar for ihatehippies
0
2K
Member Avatar for kavithabhaskar

I am looking at a source code There is a class called A and it has a parameter in its _init_ function called. Class A self.id = id There is another class called B and has a parameter in its __init__ function called Class B self.ide = ide There's an …

Member Avatar for inuasha
0
116
Member Avatar for minimee120

Hi all. I have an up and coming midterm, and this is one of the practice problems. All's I need to do is draw a Tic-Tac-Toe board in TURTLE. However, it has to be in a loop, or something, and I am having a difficult time putting it into one. …

Member Avatar for minimee120
0
162
Member Avatar for xopenex

Hello all, I found a thread similar, but it was closed... so here is the code and my question... I am wondering how to change the code from creating files to creating variables? this is the code from the thread on here.... and below it is the code that i …

Member Avatar for TrustyTony
0
198
Member Avatar for jone kim

I want to explain my code to you. 1. this code is to search for the given number whether it is present in the list or not. 2. first if statement returns the value of row if the i/p number is in the first column 3. if the given number …

Member Avatar for jone kim
0
239

The End.