15,180 Topics

Member Avatar for
Member Avatar for hbluthi

I'm making a Card class and need to make sure that the suit is valid. When I call on the Card class and construct one setting the suit to 'Jordan' it actually ok's that suit and prints 'Ace of Jordan'. Instead it should become the default, of Spades. What am …

Member Avatar for hbluthi
0
654
Member Avatar for Oldguy1

Hey I'm very new to the programming world, and what i am trying to do is produce a Koch Snowflake via turtle from python2.5. this is what I have so far... [CODE] from turtle import * def snowflake(lengthSide, levels): if levels == 0: return forward(lengthSide), right(120), forward(lengthSide), right(120), forward(lengthSide) forward(lengthSide) …

Member Avatar for ohernandezmit
0
3K
Member Avatar for robm612

Ok guys so i am trying to create 2 versions of a program which sorts items into boxes. The first version i have to create puts the item weights (integer between 1 and 20) into the first "box" they will fit into. So given the input 11,17,3,5,4 the list the …

Member Avatar for TrustyTony
0
145
Member Avatar for tk-421

Monday morning, our final exam is to write a Python program according to whatever the teacher will throw at us. Any ideas as to how or WHAT to study to be ready for anything? (Most of the class expects to fail this, btw. I don't want to be among those …

Member Avatar for Gribouillis
0
95
Member Avatar for Naynah

I have to create all the method signatures in the ResizableArrayList and then fill it in with comments. And each method is supposed to be blank with a return null or --1. How do i do this?

Member Avatar for richieking
0
105
Member Avatar for jozz3

I am working on a program with classes and a main function. This game involves tanks moving around a grid of defined size, and shooting at each other. Each tank has a name, armour and firepower. On the grid, there are randomly generated squares that contain extra armour or firepower. …

Member Avatar for taskkiller
0
122
Member Avatar for polanski

Hey everyone, new here. I'm looking for a little help with my program. Its supposed to take a txt file called test.txt, and removes all spaces trailing at the end of lines. ex. (note the spaces) "python " -> "python" "daniweb is great" -> "daniweb is great" " forum" -> …

Member Avatar for richieking
0
159
Member Avatar for convoluted

Hope you kind folk can spare a bit of advice. I'm trying to find a clever way to modifying a part of an image without replacing the image completely. For instance, let's say I have an image of a car and I would like to show the tire is flat. …

Member Avatar for richieking
0
173
Member Avatar for Hawkeye Python

Hello :) I'm from Brazil, so sorry about my english. This is the first code I post here - I'm a begginer in Python. It is a function to calculate determinants of matrices. You can attach it to a class if you wish. Please leave a comment if you wish …

Member Avatar for Gribouillis
0
3K
Member Avatar for Naynah

I'm a Python semi-beginner and i have to do a prac but the problem is i've totally forgetten how to do it! Can you please help me get started with part 1 even if its just 1.a because every time i tried to get it to work it keeps saying …

Member Avatar for Naynah
0
162
Member Avatar for HoneyBadger

Guys, how do I add an item to a list using a loop? My loop in a nutshell does this: [CODE]for w in book_line.split(" "): word_list = [] if w != "": word_list.append(w.lower()) return word_list[/CODE] While experimenting with this I got mainly two results: 1.) When I use return word_list, …

Member Avatar for HoneyBadger
0
3K
Member Avatar for KMC

Hello, I am completely stuck on a question I was assigned and was hoping for a little guidance to get me started. The question is: Create a program that outputs the molar mass of a molecule. The user will enter a molecule with each atom individually (CO2 would be entered …

Member Avatar for KMC
0
76
Member Avatar for patrickgormally

Hi! I am trying to do a project in which I draw a Christmas tree with about 3 segments, filled in with color and with writing below it saying "Merry Christmas". Sadly, I have no idea where to being! I'm able to draw the Christmas trees using stars by defining …

Member Avatar for woooee
0
3K
Member Avatar for xtra333

Hello. My instructor want me to write a magic Square code. And here is what the square is supposed to print: 11 18 25 2 9 10 12 19 21 3 4 6 13 20 22 23 5 7 14 16 17 24 1 8 15 Here is my current …

Member Avatar for woooee
0
121
Member Avatar for patrickgormally

I am reading a text file inside Python that contains salaries and the raise they will receive as a percent. I am trying to multiply the initial salary by the percent and print the salary after the raise has been applied. I keep receiving an error message which is as …

Member Avatar for patrickgormally
0
3K
Member Avatar for longlongsilver

i have my code and i want to cycle through the following colors blue green orange red yellow. i got blue but i dont know how to the rest [CODE]from Tkinter import * myfont = ("Arial", 1, "bold") window = Tk() window.title("grid") window.geometry("500x420") frame = Frame(window) frame.grid() button0 = Button(frame, …

Member Avatar for richieking
0
306
Member Avatar for HoneyBadger

Guys I have a text file, and I am trying to get my program to focus on a specific part of the text. How would I do that? I tried this to no avail: [CODE]f = open("book.txt") f.readlies()[10:3340][/CODE]

Member Avatar for TrustyTony
0
106
Member Avatar for sc2player

Hi I was wondering how to extract info from a data file, and place it in a dictionary. Say you're given a file, in the following format: [CODE]tomCruise # Username Tom Cruise # Name Los Angeles, CA # Location http://www.tomcruise.com # URL Official TomCruise.com crew tweets. We love you guys! …

0
110
Member Avatar for Elanosaurus

For my python class i have to make a game, i decided to make a simon sort of game. I'm not allowed to use any outside modules; for instance pygame. I have most if not all of the visuals done. But there are two main issues: - One issue is …

0
57
Member Avatar for M3M69

i have this code that reads a file and strips out all the non essential stuff and then i want to make a dictionary for the actors and films they have been in .. i do that but it keeps on telling me that actors isnt defined ... how am …

Member Avatar for winmic
0
87
Member Avatar for testie

Hey guys, this code is supposed to remove all the spaces at the end of each line. However from what I can tell it prints out the exact same file again instead of removing nothing. Have I been using the wrong test files? Or is there something wrong with my …

Member Avatar for richieking
0
103
Member Avatar for bretthay93

i want to make a program that has a player take on the computer in a game of Rock Paper Scissors. The GUI should have an appropriate lable at the top. it should allow the player to select his or her weapon of choice. program should have a fight button …

Member Avatar for bretthay93
0
312
Member Avatar for HoneyBadger

It's been a while since I bugged you guys. But I need the council of my wise advisers once more. I am trying to write a program that reads a .txt file, breaks each line into words, strips the whitespace and punctuation from the words and returns them in lowercase. …

Member Avatar for HoneyBadger
0
97
Member Avatar for Thropian

I making a game that would use multiple canvases drawing on one canvas then switching to another... is there any way to get a new canvas and be able to restore the old canvas with the drawings still on it?

Member Avatar for Thropian
0
199
Member Avatar for nejger

Hello! Now I have written a function for numbers over 3999: if arabicnumber<=3999: print arabToRom else: parenthesis=0 while (arabicnumber)>3999 arabicnumber/=1000 for i in range (parenthesis... etc and i compare all the numbers that i write in so if i write like 5560 it pirints out ( V ) and the …

Member Avatar for woooee
0
104
Member Avatar for Hawkeye Python

Hi! I'm new at python and I don't get the while statement. I'm trying to make a simple function that returns each term of a geometric progression 'til 'n'. [CODE]def gp(a1,r,n): while not n == 0: n = n - 1 an = a1 * (r ** n) return an[/CODE] …

Member Avatar for Hawkeye Python
0
147
Member Avatar for Binika

I would really need some help :( Write a recursive method, as a parameter to accept the folder name (absolute or relative to the current folder) that prints lists of all the files and all folders in the folder, which is given in parameter, and displays all folders in all …

Member Avatar for TrustyTony
0
214
Member Avatar for evertron

I tried this class a couple of different ways and I had it print just memory location I think one way now I have an error that says: Traceback (most recent call last): File "F:\Python_Stuff\CSC143-901\Lexicon.py", line 83, in <module> source = Lexicon.OpenFile('word') TypeError: unbound method OpenFile() must be called with …

Member Avatar for evertron
0
233
Member Avatar for MaC-CK

Good morning, I'm learning some basic programming and fundamentals and I am having a hard time troubleshooting why a certain part of my code is not working. In my "calcTotal" function, my If, Else statements do not seem to be working. The program runs through, but the output is always …

Member Avatar for MaC-CK
0
133
Member Avatar for tk-421

I need help! The Python program I need to write accepts the price of an item, the amount paid for it, and then calculates the change in the smallest number of bills/coins. I'm so lost! Can anyone help? Thanks!

Member Avatar for TrustyTony
0
13K

The End.