Skip to content

Commit edbe0cf

Browse files
committedNov 22, 2020
input added only Even/odd | boolean | simple & shortcut f
1 parent 467062e commit edbe0cf

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed
 

‎chapter_04/03.f_practice.py

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# functions practice
2-
print('--------------------------------')
3-
name = ("input your name : ")
2+
print('------return last letter---------')
3+
name = input("input your name : ")
44

55

66
def last_char(name):
77
return name[-1]
88

99

1010
print(last_char(name))
11-
print('--------------------------------')
11+
# ------------------------------------------
12+
print('--------Even or Odd detected------')
13+
num = int(input("Enter your number : "))
1214

1315

1416
def odd_even(num):
@@ -17,20 +19,21 @@ def odd_even(num):
1719
return "odd"
1820

1921

20-
print(odd_even(11))
21-
print('--------------------------------')
22+
print(odd_even(num))
23+
# ------------------------------------------
24+
print('---------boolean output-----------')
2225

2326

2427
def is_even(num):
2528
return num % 2 == 0 # True
2629

2730

28-
print(is_even(9))
29-
print('--------------------------------')
31+
print(is_even(num))
32+
print('---------greeting---------')
3033

3134

32-
def song():
33-
return "happy birthday song"
35+
def greeting():
36+
return "Thank you very much"
3437

3538

36-
print(song())
39+
print(greeting())

0 commit comments

Comments
 (0)
Please sign in to comment.