Skip to content

Commit 817a534

Browse files
authored
Update Day 1.md
1 parent 0004d0d commit 817a534

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

Status/Day 1.md

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

105105
```
106-
106+
---
107+
```python
108+
'''Solution by: minnielahoti
109+
'''
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+
print(f'the factorial of {org} is {fact}')
124+
```
107125
---
108126

109127
# Question 3
@@ -155,7 +173,26 @@ n = int(input())
155173
ans={i : i*i for i in range(1,n+1)}
156174
print(ans)
157175
```
158-
176+
---
177+
```python
178+
'''Solution by: minnielahoti
179+
'''
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+
print(dictio)
195+
```
159196
---
160197

161198
## Conclusion

0 commit comments

Comments
 (0)