-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathif-else.py
110 lines (55 loc) · 1.49 KB
/
if-else.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env python
# coding: utf-8
# In[7]:
number=int(input("Enter the number : "))
if number >1000:
print("entered the maximum value.") #same group
print('-'*50) #same group
#else:
print("if condition statement false i will run :") #different group if condition false then this will execute.
# In[10]:
balance=int(input())
if balance < 0:
transfer = -balance
# transfer enough from the backup account:
#backupAccount = backupAccount - transfer
balance = balance + transfer
# In[25]:
x=int(input())
if x >0:
x1 = x + 5
print(x1)
#print("x value is equal to one :")
y = x1+x
print(y)
#print("x value is more then five :")
#print("x value is high :")
# Different format of IF-Elif statements :-
# In[8]:
x=int(input('enter the number : '))
if x < 1 or x > 12:
print("enter invalid value : ")
elif x==2:
print("This is the month of Feb :")
elif x in (4,6,1,7,9): # x==4 or x ==6 or x==1 or x==7 or x ==9 instead of this 'in format'
print("this month is 30 days :")
else:
print("this month is 31 days :")
# example :-
# In[12]:
x=int(input("enter the month : "))
if x < 1 or x > 12:
print("invalid month selection :")
else:
if x==2:
print("Month of Feb : ")
elif x in (4,6,9,11):
print("this month is 30 days")
else:
print("this month is 31 days")
# In[ ]:
# In[ ]:
# In[ ]:
# In[ ]:
# In[ ]:
# In[ ]: