Skip to content

Instantly share code, notes, and snippets.

View akshayxarora's full-sized avatar
🎯
Focusing

Akshay Arora akshayxarora

🎯
Focusing
View GitHub Profile
print("Please think of a number between 0 and 100!")
low = 0
high = 100
ans = int((low + high) / 2)
while True:
print("Is your secret number %d " %ans)
userguess = input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly. ")
if userguess == 'h':
high = ans
elif userguess == 'l':
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print [i for i in a if (i % 2 == 0)]
str = raw_input("Enter the string to be checked ")
if (str[::1])==(str[::-1]):
print "Palindrome"
else:
print "Not a palindrome"
list = [1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 13, 14 , 1, 2, 3, 5, 7]
num = int(raw_input("Enter the numbers to be dispalyed in the list))
new_list = []
for i in list:
if i < num :
new_list.append(i)
num = int(raw_input("Enter a number"))
if num % 2 == 0
print "The number is even."
else:
print "The number is odd."
name = raw_input("Enter your name : ")
age = int(raw_input("Enter age : "))
new_age = 2017 + 100 - age
print "%s will turn 100 years old in %r year " % (name, new_age)