15,175 Topics
| |
Here is slow brute force way to find the largest palindromic product of three digit integers. You could do loop and break out of it if you go under the smaller number (the second one) of best solution found so far to be more efficient etc. | |
How the following code can be rewritten in a better way? #!/usr/bin/env python """Simple program for finding popular names over last 100 years, in response to vegaseat's last post in Projects for Beginners(9/1/2012). It first lists the popular names and then search for entered name by user""" oldnames = """Mary,Helen,Margaret,Anna,Ruth … | |
Hi guys, With Python, I am using genfromtxt (from numpy) to read in a text file into an array: `y = np.genfromtxt("1400list.txt", dtype=[('mystring','S20'),('myfloat','float')])` Which works okay, except it doesn't seem to read my 2 columns into a 2D array. I am getting: [('string001', 123.0),('string002', 456.0),('string002', 789.0)] But I think would … | |
So, maybe this is a concept out of the domain of programming... but I think not. Lets say we have a 400MB video file that we want to either send somewhere, or stream. Can we use python to break it into binary, break the binary into chunks, and then send … | |
Hi, I'm new to Python. Can someone please guide me in writing a Python script that bulk processes audio files and image files to create an audiovisual or movie out of them. Say we have 20 images and 20 audio files and want to create 20 video files out of … | |
I'm trying to open a tex file from within python, tell the tex editor to run (manually you would press ctrl + T) and finally close the program. So far I can only figure out how to open and close the program. this is what I have so far... os.spawnv(os.P_WAIT, … | |
Hello! I was trying to display/print elements of a list, suppose a = [1,2,3,4,5], using functions. But the code i wrote prints only the first element of the list whereas i needed all the elements of the list to be printed( as in 1 2 3 4 5 but all … | |
| Hello, I am having some trouble in importing a CSV file into an array. The CSV file has multiple columns, and what i really wanted to end up doing is getting the element inside each block of the CSV file. So far i've only been able to get a row … |
I am currently doing a python challenge in which I have to create certain codes. I am stuck on a particularly hard question and would appreciate some help. The problem is: In 1989, a journalist asked Paul Boutin, an engineer at the Massachusetts Institue of Technology, "What do you think … | |
So far, I think I'm doing it right however it doesn't seem to generate the results I wanted. def occurrence(e,List): for item in List: s = 0 if item == e: s += 1 return s Basically I want my function to count how many times e occurs in List. … | |
I'm trying to make a simple random name generator by pulling first and last names from text files. The problem I'm having is that sometimes the names are chopped off and incomplete with the output and sometimes the names are on two different lines. I would also like to be … | |
I developed a program I think has potential, but don't want the end user to a) have to download python and b) steal my code. How would I turn it the .py of my script into a .bat or .exe so my end user can run it? | |
I'm looking for the web online course for my learn Python Where are the best to learn python? Who know tell me, please. Thanks! | |
Modify the guess My Number program given below. Modify it so that now the player has only five guesses. If the player runs out of guesses, the program should end the game and display an appropriately chastising message. # Guess My Number # The computer picks a random number between … | |
Python & binary tree help PLEASE?!?????????please please please help me in anyway :'(? Write a Python program that : a: Takes in as input a list of numbers (Note that you have to type in these numbers using the keyboard) using: def insert(tree, key): if len(tree) == 0: return [key, … | |
Hi I am trying to automate svn checkouts using python script. this below command works from windows command prompt. I tried to use subprocess.call and subprocess.Popen , C:/Program Files/TortoiseSVN/bin/TortoiseProc.exe /command:checkout /url: http://xxx-svn/svn/branches/Common/module/Common_Jars_v1_1/lib /path:D:/svn-test1 /closeonend:2 it is not able to recognise the parameter > C:\Users\rajesh\Desktop>python svn-test.py > Traceback (most recent call … | |
I need someo #A Python text-RPG #A Jak Production #APOC global ammo global health global lives global exp global food ammo=55 health = 100 lives=10 exp = 0 food = 30 def part1(): print "50 Days After The Outbreak:You are standing outside of the Empire State Building." print "Vines, plants, … | |
Just wondering how the game would be put together, maybe even a step by step tutorial. I could use this to practice with the commands used without Tkinter or Pygame. This could be a good learning experience. | |
Hello, I am new to the forums and I am just starting to learn python. I have been writing the following program and have ran into a problem with getting it to work right. If anyone can offer some advice on what I am doing wrong I would be thankful. … | |
Could someone please tell me what this means. a[ ..., j ] Thank you | |
can someone correct this code for me? also, how do you make cmd open the .py file than execute that .py? def addition() print "This part of the test cover addition" p1 = raw_input "What is 9+9" if p1 = "18" set c()= c+1 c= 0 print "correct" else: print … | |
Hey guys, I'm trying to make an AI character perform a pattern movement when a certain action occurs rather than have him do it all the time. I call two different methods, one to move him left, then move him right, the problem is the first method is still active … | |
Just a few more explorations using a Python class to mimic a C Structure or Pascal Record. Loading the record from a csv type data file, displaying the data and sorting and searching the data in various ways. | |
| t=input() while t>0: t=t-1 m,n=input().split(" ") m=int(m) n=int(n) m=m%10 n=n%4 if n==1: print (m) elif n==2: print (m*m)%10 elif n==3: print (m*m*m)%10 else: print (m*m*m*m)%10 why this code is giving me NZEC error ? it is irritating me now. thanks |
I'm a complete beginner in the programming world, so forgive me for the basic questions. I'm trying to run Peter Norvig's spelling corrector from the Windows XP command line, but am having difficulties. I have a text file of addresses with a number of misspellings. I would like to use … | |
Please I'm new to python and I'm trying to understand a line of code. Can someone please explain to me the implications of the addition of the for loop inside brackets with the random integer generator. Thank you for i in range( 0, 50 ) : ran_values = [ random.randint( … | |
Hi! I have been using igraph to generate graphs representing social networks (i.e. people are represented by nodes/vertices and connections between people are represented by edges). This has been going well, and I've managed to plot these relationships with some success. My question: Can I associate a 2-D position with … | |
Hi, can someone please tell me if there is a way to make my server accessible from the outside world? it works pretty well on localhost. I tried port forwarding, opening the ports it uses, but nothing works. I read somewhere that it only allows connection from the same network, … | |
Which module would I look into to capture things like disc read/write speed, as well as possibly capture what the disk is reading/writing at the time. I would like to make a diagnostic module to check if my disc speed is taking a hit, as I rebuilt a PC and … | |
Hello All, I'm trying to write a function that outputs the reverse of the input. I know that you can use the built-in list.reverse() or S[::-1] methods, but I want to make it using the 'for' loop. My code initially is: def reverse(S) for x in S: print(x, end = … |
The End.