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