Lambneck Posted January 29, 2011 Share Posted January 29, 2011 Anyone know how to create a flashcard program? I have this python one (actually its more like multiple choice questions) but am wondering how to do it in php: import os, random count = 0 score = 0 file1 = open('binary.txt', 'r') file2 = open('decimal.txt', 'r') f1content = file1.readlines() f2content = file2.readlines() while count < 10: os.system('clear') wordnum = random.randint(0, len(f1content)-1) print 'Word:', f1content[wordnum], '' options = [random.randint(0, len(f2content)-1), random.randint(0, len(f2content)-1), random.randint(0, len(f2content)-1)] options[random.randint(0, 2)] = wordnum print '1 -', f2content[options[0]], print '2 -', f2content[options[1]], print '3 -', f2content[options[2]], answer = input('\nYour choice: ') if options[answer-1] == wordnum: raw_input('\nCorrect! Hit enter...') score = score + 1 else: raw_input('\nWrong! Hit enter...') count = count + 1 print '\nYour score is:', score Link to comment https://forums.phpfreaks.com/topic/226067-flashcards-in-php/ Share on other sites More sharing options...
litebearer Posted January 29, 2011 Share Posted January 29, 2011 http://sourceforge.net/projects/flashcardsphp/ Link to comment https://forums.phpfreaks.com/topic/226067-flashcards-in-php/#findComment-1167025 Share on other sites More sharing options...
Lambneck Posted January 30, 2011 Author Share Posted January 30, 2011 Thats good to know about, but its waaaay bigger than what I had in mind. I just want something basic. Again something comparable to the python i posted above. Link to comment https://forums.phpfreaks.com/topic/226067-flashcards-in-php/#findComment-1167189 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.