This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sys import argv | |
| from fractions import gcd | |
| primes = [2, 3] | |
| def isprime(p): | |
| if p == 2: return True | |
| if p % 2==0: return False | |
| max = p**0.5+1 | |
| i=3 | |
| while i <= max: | |
| if p%i==0: return False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| statement_answer_pairs = {'not False ':'true', 'not true ':'false', | |
| 'True or False ':'true', 'True or True ':'true', | |
| 'False or True ':'true', 'False or False ':'false', | |
| 'True and False ':'false', 'True and True ':'true', | |
| 'False and True ':'false', 'False and False ':'false', | |
| 'not (True or False) ':'false', 'not (True or True) ':'false', | |
| 'not (False or True) ':'false', 'not (False or False) ':'true', | |
| 'not (True and False) ':'true', 'not (True and True) ':'false', | |
| 'not (False and True) ':'true', 'not (False and False) ':'true', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sys import argv | |
| open(argv[2], 'w').write(open(argv[1]).read()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sys import argv | |
| script, first, second, third = argv | |
| print "this script , called %s, is going to ask you the questions %s, %s, %s" % ( script, first, second, third) | |
| first_answer = raw_input(first) | |
| second_answer = raw_input(second) | |
| third_answer = raw_input(third) | |
| print "for question %r, you answered %s" % ( first, first_answer) |
NewerOlder