Pages

Bangladeshi Blog

Friday, January 14, 2011

1. Life, the Universe, and Everything

code:
while 1: 
    num = int(raw_input()) 

    if num == 42: 
        break 
    else: 
        print num
Be Pythonic

4 comments:

Unknown said...

;)

Unknown said...

Given str1 = "Life, the universe and everything." What does str1.rfind("ve") return? (In Python?)

Asad said...




while 1:
num = int(input("Enter Input number : "))
if num==42:
break
else:
print(num)
Note : This is the solution for pyton 3+ version

RISHABH said...


n=[]

for i in range(0,100):

s=int(raw_input())
if (s!=42):
n.append(s)
elif (s==42):
break


print n

why is this wrong??

Post a Comment