committed by
Aditya Bhargava
parent
f9497eb344
commit
2f939182ae
@@ -1,13 +1,13 @@
|
|||||||
def greet2(name):
|
def greet2(name):
|
||||||
print "how are you, " + name + "?"
|
print("how are you, ", name, "?")
|
||||||
|
|
||||||
def bye():
|
def bye():
|
||||||
print "ok bye!"
|
print("ok bye!")
|
||||||
|
|
||||||
def greet(name):
|
def greet(name):
|
||||||
print "hello, " + name + "!"
|
print("hello, ", name, "!")
|
||||||
greet2(name)
|
greet2(name)
|
||||||
print "getting ready to say bye..."
|
print("getting ready to say bye...")
|
||||||
bye()
|
bye()
|
||||||
|
|
||||||
greet("adit")
|
greet("adit")
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ def fact(x):
|
|||||||
else:
|
else:
|
||||||
return x * fact(x-1)
|
return x * fact(x-1)
|
||||||
|
|
||||||
print fact(5)
|
print(fact(5))
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ def sum(arr):
|
|||||||
total += x
|
total += x
|
||||||
return total
|
return total
|
||||||
|
|
||||||
print sum([1, 2, 3, 4])
|
print(sum([1, 2, 3, 4]))
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
voted = {}
|
voted = {}
|
||||||
def check_voter(name):
|
def check_voter(name):
|
||||||
if voted.get(name):
|
if voted.get(name):
|
||||||
print "kick them out!"
|
print("kick them out!")
|
||||||
else:
|
else:
|
||||||
voted[name] = True
|
voted[name] = True
|
||||||
print "let them vote!"
|
print("let them vote!")
|
||||||
|
|
||||||
check_voter("tom")
|
check_voter("tom")
|
||||||
check_voter("mike")
|
check_voter("mike")
|
||||||
|
|||||||
Reference in New Issue
Block a user