[QUOTE=CurtisBridges;251348][IMG]file:///C:/Documents%20and%20Settings/Curtis%20Bridges/My%20Documents/My%20Pictures/Dinosaurs/scan.gif[/IMG][/QUOTE]

This is really a school example of how post shouldn't look like!

You can, for fun, choose sort algorithm, use list of words (strings) and use len() for comparison...
[url]http://www.daniweb.com/code/snippet452.html[/url]
Then, if you have problems making it work you can post code, so we can see what is wrong ;)

You can define matrix using list:
[code]
matrix = [[1,2,3],[4,5,6],[7,8,9]]

print matrix[0][1]
[/code]

As for multiplication program and Pascal's triangle, you'll need to show some effort. Matrix is not needed for displaying Pascal's triangle

Try to modify your save to file function.
Here's what I would do:
[php]
def save_students(filename,students):
out_file = open(filename, "w")
for x in students.keys():
out_file.write(str(x)+","+str(students[x])+"\n")
out_file.close()
[/php]

Is this is what you want?

Max.... will be also written to a file.

Well, you have defined function get_questions() not to take any arguments, but in lines:
[code]
while current < len(get_questions(index)):
[/code]
and
[code]
print current,". ",get_questions(current)
[/code]
you're passing argument to it.
If you want your function to deal with arguments, you need to define it that way.

I would do something like this ( I reserve right to be completely wrong ;) ):
[php]
true = 1
false = 0
def get_questions(x = -1):
lista = [["What colour is the daytime sky on a clear day?","blue"],\
["What is the answer to life, the universe and everything?","42"],\
["What is a three letter word for mouse trap?","cat"],\
["What noise does a truly advanced machine make?","ping"]]
if x == -1:
return lista
else: #of course, it's recommended to check if x is out of bounds
return lista[x]

menu_item = 0
while menu_item != 9:
print "------------------------------------"
print "1. Take test"
print "2. Display all questions and answers."
print "9. quit"
menu_item = input("Pick an item from the menu: ")
if menu_item == 1:
def check_question(question_and_answer):
question = question_and_answer[0]
answer = question_and_answer[1]
given_answer = raw_input(question) #what if user just press Enter?
if answer == given_answer:
print "Correct"
return true
else:
print "Incorrect, correct was: ",answer
return false
def run_test(questions):
if len(questions) == 0:
print "No questions were given."
return
index = 0
right = 0
while index < len(questions):
if check_question(questions[index]):
right = right + 1
index = index + 1
print "You got ", right*100/len(questions),"% right out of",len(questions)
run_test(get_questions())

elif menu_item == 2: ...

I'm not really sure if I understood you correctly, but maybe, this is what you want?

[code]
def percentage(student_marks, total_quiz_marks):

quiz_precentage = []
stud_marks_min = student_marks[0];
tot_q_marks_min = total_quiz_marks[0]

for position in range(len(student_marks)):

    quiz_precentage.append(float(student_marks[position]) / float(total_quiz_marks[position]))

    if stud_marks_min > student_marks[position]:
        stud_marks_min = student_marks[position]
    if tot_q_marks_min > total_quiz_marks[position]:
        tot_q_marks_min = total_quiz_marks[position]

return ( quiz_precentage, stud_marks_min, tot_q_marks_min )

[/code]

Well, I think that it's good to learn Python as a second language (after C or better C++) because in many introductionary texts I found there are a lot of comparisions with C and C++. If you're a beginer, then, these infos means nothing to you, and if you have some experience with C and C++ you'll learn new languages such as Python a lot more faster.

  • Micko

[QUOTE=bumsfeld]I don't think Python is better than C++, but you can do thinks at a higher level with it.[/QUOTE]

And, of course, with less frustrations and headache ;)

Try to find a good IDE for Python, it should have a good debugger. Try Wing IDE... It's a little slow but powerful. I write programs in DrPython and then (if needed) switch to wing IDE to debug

  • Micko

[QUOTE=CutCrusader]alright, I'm new to this community and I have been reading the beginners posts, and I am still having trouble. I need to design a function for a class. It needs to convert decimal numbers to base 16. So for example if the input is 705083, then the function should return AC23B. I have been trying to do this and am having some trouble. I am going to keep trying but I would appreciate any help I can get. Thanks a lot[/QUOTE]

Number is a number, a coulpe of bytes in memory. It's more about representation....
Try this:
[code]
def foo (x):
try:
y = int (x)
except ValueError:
print 'Not a valid number'
return '%X' % y

print foo(705083)
[/code]

  • Micko

[QUOTE=shanenin]For my simple programs I have wirtten, I have just been using a simple editer with syntax highlighting. This seems sufficient. What kinds of thing can a good IDE do for me?[/QUOTE]

Well one thing is a feature called automatic code completion. It's very helpful and reduce number of sytanx mistakes. Also a good IDE shoud have debugger to help you debug programs. Imagine you have a cod with thousands lines and it's not work as you expected, how to trace bug then? Good IDE spped up writing good and reliabe programs.

  • Micko