Hi,
I've been learning python for quite a while now, and I understand everything very well, except class.
So, if somebody could help me understand class. I think my main problem with not understanding class is that I'm not sure how I should use it in a program.
Thanks.
User Profile
Collapse
-
simple deleting problem
I need some help figuring out what the problem on this. It actually a simple program that just read lines that has comment of #, if it does it delete that line and moves on. But for some reason it not working very well.
Code:#!/bin/python input = open('/boot/config', 'r') output = open('/tmp/config', 'w') lines = input.readlines() number = 0 for line in lines: if line[0] == "#":
-
negative number problem
so heres my code
Code:input = open('DATA1.txt', 'r') output = open('OUT1.txt', 'w') numbers = input.readlines() for x in range(1): set = numbers[x] a = float(set[6]) b = float(set[4]) c = float(set[2]) d = float(set[0]) r = (a - b)**2 + (c - d)**2 answer = round(r * 3.14169,3) output.writelines('%s\n' % answer) output.close()
-
Yes, that really helped thanks, program works fine now : D.
I didn't actually know you could assign a variable to a function.... -
Carrying values over in a function
I'm pretty new to python, and I'm currently having problems carrying a value inside a function, to be used again by another function.
I'm not sure if that make sense, and I don't really have a good simple example, sorry.
And since I'm totally new to programming I might just be misunderstandin g what a function really does.
No activity results to display
Show More
Leave a comment: