Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4867b33

Browse files
Format Updates
1 parent f9ca925 commit 4867b33

File tree

6 files changed

+288
-119
lines changed

6 files changed

+288
-119
lines changed

‎.ipynb_checkpoints/Practice_code2-checkpoint.md

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,38 @@ Try working online at:
44
[Coding Ground - Tutorials Point](https://www.tutorialspoint.com/execute_python3_online.php)
55
[Online Compiler and Debugger](https://www.onlinegdb.com/online_python_compiler)
66

7+
---
8+
79
**Q1:** Write a program to get a number as input and print if it is odd or even.
810

9-
>Sample1:
11+
>**Sample 1:**
1012
I/P: 10
1113
O/P: Even
1214

13-
>Sample 2:
15+
<br>
16+
>**Sample 2:**
1417
I/P: 11
1518
O/P: Odd
1619

20+
---
21+
1722
**Q2:** Write a program to get a number as input and check whether it is positive, negative or zero.
18-
>Sample1:
23+
>**Sample 1:**
1924
I/P: 10
2025
O/P: Positive
2126

22-
>Sample2:
27+
<br>
28+
>**Sample 2:**
2329
I/P: 0
2430
O/P: Zero
2531

26-
>Sample3:
32+
<br>
33+
>**Sample 3:**
2734
I/P: -5
2835
O/P: Negative
2936

37+
---
38+
3039
**Q3:** Write a program to get the mark of a student as input print his grade.
3140

3241
**Condition:**
@@ -40,35 +49,52 @@ mark < 0 or mark > 100: Invalid
4049
0 <= mark < 50: Fail
4150
```
4251

43-
>Sample1:
52+
>**Sample 1:**
4453
I/P: 85
4554
O/P: A+
4655

47-
>Sample2:
56+
<br>
57+
>**Sample 2:**
4858
I/P: 10
4959
O/P: Fail
5060

61+
---
62+
5163
**Q4:** Write a program to get the age of the user and print if he is eligible to vote.
64+
5265
**Condition:**
5366
A person is eligible to vote if his/her age is greater than or equal to 18
54-
>Sample1:
67+
>**Sample 1:**
5568
I/P: 10
5669
O/P: Ineligible
5770

58-
>Sample2:
71+
<br>
72+
>**Sample 2:**
5973
I/P: 27
6074
O/P: Eligible
6175

76+
---
77+
6278
**Q5:** Code a simple Calculator.
6379

80+
---
81+
6482
**Q6:** Write a program to get an input from the user and print if it is a vowel or a consonant.
6583

84+
---
85+
6686
**Q7:** Write a program to two numbers and print the greatest of them.
6787

88+
---
89+
6890
**Q8:** Write a program to get three numbers and the print the greatest of them.
6991

92+
---
93+
7094
**Q9:** Write a program to check if a number is a perfect square or not.
7195

96+
---
97+
7298
**Q10:** The humidity (in percentage) and temperature (in celsius) value in a city is given as the input to the program. The program must print ***YES*** as the output if there is a possibility of rain. Else the program must print ***NO*** as the output. If one of the conditions given below is true then there is a possibility of rain.
7399

74100
*Condition:*
@@ -77,6 +103,8 @@ O/P: Eligible
77103
3. Humidity > 70 and Temperature < 30
78104
4. Humidity > 60 and Temperature < 24
79105

106+
---
107+
80108
**Q11:** Write a program to get a year as input and print if it is a leap year or not.
81109
A year is leap if it is either divisible *4* or *400* and not *100*.
82110

‎.ipynb_checkpoints/Practice_code3-checkpoint.md

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,22 @@ Try working online at:
44
[Coding Ground - Tutorials Point](https://www.tutorialspoint.com/execute_python3_online.php)
55
[Online Compiler and Debugger](https://www.onlinegdb.com/online_python_compiler)
66

7+
---
8+
79
**Q1:** Write a program to get the value of ***n*** from the user and print sum of ***n*** natural numbers as output.
810

11+
---
12+
913
**Q2:** Write a program to get the values of ***n*** and ***n*** numbers from the user and print sum of the ***n*** numbers as output.
10-
I/p:
14+
Input:
15+
1116
First line contains the number ***n***
1217
Next n lines contain ***n*** integers
13-
O/p:
14-
Sum of n numbers
15-
>Sample1:
18+
19+
Output:
20+
Sum of n numbers
21+
22+
>**Sample 1:**
1623
I/P:
1724
10 <br>
1825
1 <br>
@@ -27,45 +34,67 @@ I/P:
2734
-1<br>
2835
O/p: 167
2936

37+
---
38+
3039
**Q3:** Write a program get a number from user and print if it is prime or composite.
3140

41+
---
42+
3243
**Q4:** Write a program to get a number from the user and print its factorial as output.
3344

45+
---
46+
3447
**Q5:** Write a program to get the value of ***n*** from the user and print the first ***n*** terms of the Fibonacci series as output.
3548

49+
---
50+
3651
**Q6:** Write a program to get a number ***n*** from the user and print its reverse as output.
3752

53+
---
54+
3855
**Q7:** Write a program to get a number and check if it is an armstrong number or not.
56+
3957
**Condition:** Armstrong / Narcissistic number is the number in any given number base, which forms the total of the same number, when each of its digits is raised to the power of the number of digits in the number.
40-
>Sample 1:
58+
>**Sample 1:**
4159
I/P:
4260
153
4361
O/P:
4462
Armstrong Number
63+
4564
**Explanation:** $ 1^3 + 5^3 + 3^3 = 153 $
4665

47-
>Sample 2:
66+
<br>
67+
>**Sample 2:**
4868
I/P:
4969
407
5070
O/P:
5171
Armstrong Number
5272
**Explanation:** $ 4^3 + 0^3 + 7^3 = 407 $
5373

54-
>Sample 3:
74+
<br>
75+
>**Sample 3:**
5576
I/P:
5677
107
5778
O/P:
5879
Not an Armstrong Number
5980

81+
---
82+
6083
**Q8:** Write a program to get a number ***n*** and print its multiplication table from 1 to 20.
6184

85+
---
86+
6287
**Q9:** Write a program to get the values of ***n*** and ***n*** numbers from the user and print average of the ***n*** numbers rounded off to 4 decimal places as output.
63-
I/p:
88+
Input:
89+
6490
First line contains the number ***n***
6591
Next n lines contain ***n*** integers
66-
O/p:
67-
Average of n numbers
68-
>Sample1:
92+
93+
Output:
94+
95+
Average of n numbers
96+
97+
>**Sample 1:**
6998
I/P:
7099
10 <br>
71100
1 <br>
@@ -80,10 +109,16 @@ I/P:
80109
-1<br>
81110
O/p: 16.7
82111

112+
---
113+
83114
**Q10:** Write a program to get a number ***n*** and print the ***nth*** term of Fibonacci series as output.
84115

116+
---
117+
85118
**Q11:** Write a program to get two numbers as input and print their **HCF** as output.
86119

120+
---
121+
87122
**Q12:** Write a program to get two numbers as input and print their **LCM** as output.
88123

89124
****

‎Practice_code2.md

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,38 @@ Try working online at:
44
[Coding Ground - Tutorials Point](https://www.tutorialspoint.com/execute_python3_online.php)
55
[Online Compiler and Debugger](https://www.onlinegdb.com/online_python_compiler)
66

7+
---
8+
79
**Q1:** Write a program to get a number as input and print if it is odd or even.
810

9-
>Sample1:
11+
>**Sample 1:**
1012
I/P: 10
1113
O/P: Even
1214

13-
>Sample 2:
15+
<br>
16+
>**Sample 2:**
1417
I/P: 11
1518
O/P: Odd
1619

20+
---
21+
1722
**Q2:** Write a program to get a number as input and check whether it is positive, negative or zero.
18-
>Sample1:
23+
>**Sample 1:**
1924
I/P: 10
2025
O/P: Positive
2126

22-
>Sample2:
27+
<br>
28+
>**Sample 2:**
2329
I/P: 0
2430
O/P: Zero
2531

26-
>Sample3:
32+
<br>
33+
>**Sample 3:**
2734
I/P: -5
2835
O/P: Negative
2936

37+
---
38+
3039
**Q3:** Write a program to get the mark of a student as input print his grade.
3140

3241
**Condition:**
@@ -40,35 +49,52 @@ mark < 0 or mark > 100: Invalid
4049
0 <= mark < 50: Fail
4150
```
4251

43-
>Sample1:
52+
>**Sample 1:**
4453
I/P: 85
4554
O/P: A+
4655

47-
>Sample2:
56+
<br>
57+
>**Sample 2:**
4858
I/P: 10
4959
O/P: Fail
5060

61+
---
62+
5163
**Q4:** Write a program to get the age of the user and print if he is eligible to vote.
64+
5265
**Condition:**
5366
A person is eligible to vote if his/her age is greater than or equal to 18
54-
>Sample1:
67+
>**Sample 1:**
5568
I/P: 10
5669
O/P: Ineligible
5770

58-
>Sample2:
71+
<br>
72+
>**Sample 2:**
5973
I/P: 27
6074
O/P: Eligible
6175

76+
---
77+
6278
**Q5:** Code a simple Calculator.
6379

80+
---
81+
6482
**Q6:** Write a program to get an input from the user and print if it is a vowel or a consonant.
6583

84+
---
85+
6686
**Q7:** Write a program to two numbers and print the greatest of them.
6787

88+
---
89+
6890
**Q8:** Write a program to get three numbers and the print the greatest of them.
6991

92+
---
93+
7094
**Q9:** Write a program to check if a number is a perfect square or not.
7195

96+
---
97+
7298
**Q10:** The humidity (in percentage) and temperature (in celsius) value in a city is given as the input to the program. The program must print ***YES*** as the output if there is a possibility of rain. Else the program must print ***NO*** as the output. If one of the conditions given below is true then there is a possibility of rain.
7399

74100
*Condition:*
@@ -77,6 +103,8 @@ O/P: Eligible
77103
3. Humidity > 70 and Temperature < 30
78104
4. Humidity > 60 and Temperature < 24
79105

106+
---
107+
80108
**Q11:** Write a program to get a year as input and print if it is a leap year or not.
81109
A year is leap if it is either divisible *4* or *400* and not *100*.
82110

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /