w2-Day1-Batch1 (05-05-2025) - Jupyter Notebook
w2-Day1-Batch1 (05-05-2025) - Jupyter Notebook
elif:
syntax:
if(condition1): True
statement
elif(condition2): True
statement
else:
statement
Enter n1 value: 23
Enter n2 value: 56
Enter n3 value: 10
n2 is biggest of n1 and n3
localhost:8888/notebooks/SOI-Batch1-(April-2025)/week2/w2-Day1-Batch1(05-05-2025).ipynb 1/9
5/5/25, 8:09 PM w2-Day1-Batch1(05-05-2025) - Jupyter Notebook
elif ladder:
syntax:
if(condition1):
statement
elif(condition2):
statement
elif(condition3):
statement
"
"
"
elif(conditionn):
statement
else:
statement
localhost:8888/notebooks/SOI-Batch1-(April-2025)/week2/w2-Day1-Batch1(05-05-2025).ipynb 2/9
5/5/25, 8:09 PM w2-Day1-Batch1(05-05-2025) - Jupyter Notebook
In [3]: 1 # Write a program to print the week day of a given input number?
2 day = int(input(("Enter day number: ")))
3 if(day == 1):
4 print('sunday')
5 elif(day == 2):
6 print('Monday')
7 elif(day == 3):
8 print('Tuesday')
9 elif(day == 4):
10 print('wednesday')
11 elif(day == 5):
12 print('thursday')
13 elif(day == 6):
14 print('Friday')
15 elif(day == 7):
16 print('saturday')
17 else:
18 print('Your enter invalid week number!...')
19
netsed if-else:
syntax:
if(condition):
if(condition):
statement
else:
statement
else:
statement
localhost:8888/notebooks/SOI-Batch1-(April-2025)/week2/w2-Day1-Batch1(05-05-2025).ipynb 3/9
5/5/25, 8:09 PM w2-Day1-Batch1(05-05-2025) - Jupyter Notebook
localhost:8888/notebooks/SOI-Batch1-(April-2025)/week2/w2-Day1-Batch1(05-05-2025).ipynb 4/9
5/5/25, 8:09 PM w2-Day1-Batch1(05-05-2025) - Jupyter Notebook
1 2 3 4 5
iteration2:
0 1 2 3 4 5 6 7 8 9 10
1 4 7 10
localhost:8888/notebooks/SOI-Batch1-(April-2025)/week2/w2-Day1-Batch1(05-05-2025).ipynb 5/9
5/5/25, 8:09 PM w2-Day1-Batch1(05-05-2025) - Jupyter Notebook
Enter n range: 30
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
Enter n range: 20
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Enter m range: 5
5 4 3 2 1
100 97 94 91 88 85 82 79 76 73 70 67 64 61 58 55 52 49 46 43 40 37 34 31 28 25 22 19 16 13 10 7 4
localhost:8888/notebooks/SOI-Batch1-(April-2025)/week2/w2-Day1-Batch1(05-05-2025).ipynb 6/9
5/5/25, 8:09 PM w2-Day1-Batch1(05-05-2025) - Jupyter Notebook
7 - but we condition
8 - while loop is working on condition
9 - It is mainly working on numbers related programs.
1 2 3 4
localhost:8888/notebooks/SOI-Batch1-(April-2025)/week2/w2-Day1-Batch1(05-05-2025).ipynb 8/9
5/5/25, 8:09 PM w2-Day1-Batch1(05-05-2025) - Jupyter Notebook
1 2 3 4 6 7 8 9
1 - Task1:
2 - To print the month names of a given input number?
3 - sample : input: 1
4 - output: january
5 - Task2:
6 - To perform all airthmetic operations using elif ladder of given input chioce? 1-> addition, 2-> subtraction
7 - to two input numbers.
8 - sample : enter your choice : 2
9 a = 2 , b= 5
10 - output: 2-5 => -3
11 - Task3:
12 - To print the factorial of given number?
13 - Task4:
14 - TO check the whether the given number is prime number or not?
15 - Task5:
16 - To print the reverse of given number?
17 - Task6:
18 - To check whether the given number or palindrome or not?
localhost:8888/notebooks/SOI-Batch1-(April-2025)/week2/w2-Day1-Batch1(05-05-2025).ipynb 9/9