Skip to content

Commit ce216ac

Browse files
author
TechMainul
committedOct 24, 2020
06.and_or.py added exercise
1 parent 3c94af6 commit ce216ac

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed
 

‎chapter_02/08.string_slicing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
print(lang[-1:7])
99
print(lang[:])
1010
print(lang[3:])
11-
print(lang[:3])
11+
print(lang[:1])

‎exercise/06.and_or.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,23 @@
33
# if user's name start with ('a' or 'A') and age is above 10 then print "you can watch coco movie"
44
# Else print 'sorry', you can't watch coco
55

6-
name, age = 'Akash', 26
6+
first_letter, age = 'a', 10
7+
8+
#input type (01)-------------------------------------------->>>>>>
9+
# user_name = input("enter your name : ")
10+
# user_age = int(input("enter your age : "))
11+
12+
#input type (02)-------------------------------------------->>>>>>
13+
user_name, user_age = input("Enter your Name, age with comma separated : ").split(",")
14+
15+
print("Result-------------------->")
16+
17+
#condition type (01)-------------------------------------------->>>>>>
18+
# if first_letter == user_name.lower()[:1] and age <= int(user_age):
19+
# print("you can watch coco movie")
20+
# else:
21+
# print("Sorry")
22+
23+
#condition type (02)-------------------------------------------->>>>>>
24+
print("you can watch coco movie") if first_letter == user_name.lower()[:1] and age <= int(user_age) else print("Sorry")
25+

0 commit comments

Comments
 (0)