BA7 Notebook PDF
BA7 Notebook PDF
In [17]:
w = int(input('Enter Weight'))
if(w <= 15):
print("Weight under limit")
else:
extraW = w - 15
amount = 500 * extraW
print("Extra amount ", amount)
Enter Weight20
Extra amount 2500
In [18]:
In [19]:
In [20]:
In [21]:
In [22]:
c = input('input a letter')
if (c=='a' or c=='e' or c == 'i' or c == 'o' or c == 'u' or c=='A' or c=='E' or c == 'I' or c == 'O' or c == 'U' ):
print("Vowel")
else:
print("Consonent")
input a lettera
Vowel
Nested if-else
localhost:8888/notebooks/Term4S/scripts/BA7-Notebook.ipynb# 1/2
1/23/23, 3:25 PM BA7-Notebook - Jupyter Notebook
If :
if :
else:
else:
if :
else:
In [25]:
n = 0
if n !=0:
if n%2==0:
print("even")
else:
print("odd")
else:
print("0 is neither even nor odd")
In [ ]:
w = int(input('Enter Weight'))
if w > 50:
print("not Allowed")
else:
if(w <= 15):
print("Weight under limit")
else:
extraW = w - 15
amount = 500 * extraW
print("Extra amount ", amount)
localhost:8888/notebooks/Term4S/scripts/BA7-Notebook.ipynb# 2/2