Skip to content

Commit 2a11312

Browse files
authored
Merge pull request darkprinx#23 from minnielahoti/patch-1
Added my version of solutions
2 parents 86304d4 + e6d8013 commit 2a11312

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

Status/Day 1.md renamed to Status/Day 1_minnie.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,25 @@ print fact(x)
103103
print(shortFact(n))
104104

105105
```
106+
- **Including Try and Except Blocks**
106107

108+
```python
109+
#Solution by minnielahoti
110+
111+
while True:
112+
try:
113+
num = int(input("Enter a number: "))
114+
break
115+
except ValueError as err:
116+
print(err)
117+
118+
org = num
119+
fact = 1
120+
while num:
121+
fact = num * fact
122+
num = num - 1
123+
124+
print(f'the factorial of {org} is {fact}')
107125
---
108126

109127
# Question 3
@@ -155,12 +173,31 @@ n = int(input())
155173
ans={i : i*i for i in range(1,n+1)}
156174
print(ans)
157175
```
176+
- **Including Try and Except Blocks**
158177

178+
```python
179+
#Solution by minnielahoti
180+
181+
while True:
182+
try:
183+
num = int(input("Enter a number: "))
184+
break
185+
except ValueError as err:
186+
print(err)
187+
188+
dictio = dict()
189+
for item in range(num+1):
190+
if item == 0:
191+
continue
192+
else:
193+
dictio[item] = item * item
194+
195+
print(dictio)
159196
---
160197

161198
## Conclusion
162199

163-
**_These was the solved problems of day 1. The above problems are very easy for the basic syntex learners.I have shown some easy ways of coding in my solutions. Lets see how to face and attack new problems in the next day._**
200+
**_These were the solved problems of day 1. The above problems are very easy for the basic syntex learners.I have shown some easy ways of coding in my solutions. Lets see how to face and attack new problems in the next day._**
164201

165202
[**_go to next day_**](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%202.md "Next Day")
166203

0 commit comments

Comments
 (0)