This file contains 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
2015-09-29 15:47:03 +0700 | |
python | |
configure.py | |
--confirm-license | |
--bindir=/usr/local/Cellar/pyqt/4.11.3_1/bin | |
--destdir=/usr/local/Cellar/pyqt/4.11.3_1/lib/python2.7/site-packages | |
--sipdir=/usr/local/Cellar/pyqt/4.11.3_1/share/sip | |
Determining the layout of your Qt installation... |
This file contains 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
#include <stdio.h> | |
#define PRIME_SIZE 20 | |
void primenum(int *pPrimeArray, int nSize) | |
{ | |
pPrimeArray[0] = 2; | |
for (int i = 1; i<nSize; i++) | |
{ | |
int j; | |
int n = pPrimeArray[i-1]; // last prime | |
do |
This file contains 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
#!/usr/bin/python3 | |
import datetime | |
def main(): | |
age = input("Please enter your age : ") | |
print("You will be 100 years in %d" % (datetime.datetime.now().year+(100-age))) | |
if __name__ == '__main__': | |
main() |
This file contains 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
#!/usr/bin/python3 | |
import sys | |
def main(): | |
num = input("please enter the number : ") | |
if num.isnumeric() != True: | |
print("Please enter the number") | |
sys.exit(1) | |
if num % 2 == 0: | |
print("this number is even") |
This file contains 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
#!/usr/bin/python3 | |
# Take a list, say for example this one: | |
# a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
# and write a program that prints out all the elements of the list that are less than 5. | |
# Extras: | |
# 1. Instead of printing the elements one by one, make a new list that has all the elements less than 5 from this list in it and print out this new list. | |
# 2. Write this in one line of Python. |
This file contains 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
#!/usr/bin/python3 | |
def main(): | |
ref = input("Please enter the divisor : ") | |
print([ans for ans in range(2,10) if ans % ref == 0]) | |
if __name__ == '__main__': | |
main() |
This file contains 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
#!/usr/bin/python3 | |
def main(): | |
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] | |
ans = list(set([num for num in a if num in a and num in b])) | |
print(ans) | |
if __name__ =='__main__': | |
main() |
This file contains 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
#!/usr/bin/python3 | |
def main(): | |
text = input("Please enter the text to test : ") | |
if text == text[::-1]: | |
print("This text is palindrome.") | |
else: | |
print("This text is not palindrome.") |
This file contains 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
#!/usr/bin/python3 | |
def main(): | |
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] | |
b = [i for i in a if i % 2 == 0] | |
print(b) | |
if __name__=='__main__': |
This file contains 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
# you can write to stdout for debugging purposes, e.g. | |
# print "this is a debug message" | |
def solution(A): | |
# write your code in Python 2.7 | |
# Split list into 2 list | |
if len(A) == 0: | |
return 0 | |
if len(A) == 1: | |
return A[0] |
OlderNewer