Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions solutions/BhoomiJaiswal/Q1_solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def factorial(n):
if n < 0:
return "Factorial does not exist for negative numbers"
elif n == 0 or n == 1:
return 1
else:
result = 1
for i in range(2, n + 1):
result *= i
return result

# Test
num = 5
print(f"Factorial of {num} is: {factorial(num)}")

10 changes: 10 additions & 0 deletions solutions/BhoomiJaiswal/Q4_solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def is_palindrome(s):
s = s.lower().replace(" ", "") # Normalize the string
return s == s[::-1]

# Test
text = "madam"
if is_palindrome(text):
print(f'"{text}" is a palindrome.')
else:
print(f'"{text}" is not a palindrome.')
Binary file added solutions/BhoomiJaiswal/Screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added submissions/BhoomiJaiswal/Q1/Screenshot (59).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions submissions/BhoomiJaiswal/Q1/solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def factorial(n):
if n < 0:
return "Invalid input"
result = 1
for i in range(2, n + 1):
result *= i
return result

print(factorial(5)) # Output: 120
Binary file added submissions/BhoomiJaiswal/Q4/Screenshot (60).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions submissions/BhoomiJaiswal/Q4/solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def is_palindrome(s):
s = s.lower().replace(" ", "")
return s == s[::-1]

print(is_palindrome("madam")) # Output: True