Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f9ca22b
Solved problem 1
adarshramk Dec 6, 2024
22476e3
Solved problem 1
adarshramk Dec 6, 2024
3c4becf
Solved problem 1
adarshramk Dec 6, 2024
126e094
Solved problem m1
adarshramk Dec 6, 2024
47cf47b
resolving leap prob
MUKILVELAN007 Dec 6, 2024
ecfbab5
Solved problem 2
adarshramk Dec 6, 2024
fec59e8
resolving largest num
MUKILVELAN007 Dec 6, 2024
16c7c78
Merge pull request #1 from Mathi27/main
gopi8814 Dec 6, 2024
8918dc8
Solved problem
adarshramk Dec 6, 2024
2a1a761
resolving add or even
MUKILVELAN007 Dec 6, 2024
97111f4
check whether the given number is positive,negetive,or zero
MUKILVELAN007 Dec 6, 2024
4b86fee
find the largest two number
gopi8814 Dec 6, 2024
9483b97
Solved problem
adarshramk Dec 6, 2024
4e4413a
leap year or not leap year
gopi8814 Dec 6, 2024
055a07c
Solved problem
adarshramk Dec 6, 2024
f055646
Grading system
MUKILVELAN007 Dec 6, 2024
4d05a47
grade system
gopi8814 Dec 6, 2024
b56b21e
Merge pull request #62 from gopi8814/main
Mathi27 Dec 6, 2024
cae0ce0
updated easy_q4.py
Dec 6, 2024
a26bff3
Grading system
MUKILVELAN007 Dec 6, 2024
e5466f6
Numbers from 1 to n
MUKILVELAN007 Dec 6, 2024
e9cb96f
Solved problem
adarshramk Dec 6, 2024
7399ccd
updated eassy_3.py
Dec 6, 2024
3ef91dc
Solved problem
adarshramk Dec 6, 2024
543369d
Splved problem
adarshramk Dec 6, 2024
d50f6bd
Solved problem
adarshramk Dec 6, 2024
fbe4c71
m1.py
Dec 6, 2024
f3953d4
Merge branch 'staging-1' into main
Mathi27 Dec 6, 2024
762815d
Merge pull request #74 from adarshramk/main
Mathi27 Dec 6, 2024
af798e9
sum of digits
MUKILVELAN007 Dec 6, 2024
a8dd4c6
Merge branch 'main' into staging-1
Mathi27 Dec 6, 2024
cc1d2fe
mathemeticl operation
MUKILVELAN007 Dec 6, 2024
4d1119f
m2.py updated
Dec 6, 2024
c1d4ec4
fun project array cmpany
Dec 7, 2024
4799f98
updated fun project mastermind
Dec 7, 2024
593dd04
updated snake and ladder
Dec 7, 2024
1c144c2
updated rock,paper,scissors
Dec 7, 2024
85ea962
Merge branch 'staging-1' into main
Mathi27 Dec 7, 2024
bc43951
Merge pull request #126 from sowmya2006-s/main
Mathi27 Dec 7, 2024
ed83848
Merge branch 'staging-1' into main
Mathi27 Dec 7, 2024
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
19 changes: 9 additions & 10 deletions FunProjects/MasterMind.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@

'''A low-level implementation of the classic game “Mastermind”. We need to write a program that generates a four-digit random
code and the user needs to guess the code in 10 tries or less. If any digit out of the guessed four-digit code is wrong,
the computer should print out “B”. If the digit is correct but at the wrong place, the computer should print “Y”.
If both the digit and position is correct, the computer should print “R”'''

import random
If both the digit and position is correct, the computer should print “R”'''


import random
def gen_code():
set_code = []

for i in range(4):
val = random.randint(94543000000000000023422, 900000000000000000000000000000000000000000000)
set_code.append(val)
for i in range(4):
val = random.randint(0, 9)
set_code.append(val)

return set_code

Expand All @@ -26,9 +25,9 @@ def input_code():
def mastermind():

genCode = gen_code()
i = 340
i = 0

while i < 1000000:
while i < 10:
result = ""
inputCode = [int(c) for c in input_code()]

Expand All @@ -52,7 +51,7 @@ def mastermind():
result+="B"
print(result)

i += 11
i += 1
else:
print("You ran out of trys !", genCode)

Expand Down
21 changes: 17 additions & 4 deletions FunProjects/arrayCompare.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,29 @@
'''
# function to compare the arrays
def comp(array1, array2):


# Handle edge cases where one or both arrays could be None
if array1 is None or array2 is None:
return array1 == array2 # Return True only if both are None

# Check if sorted squares of array1 are equal to sorted elements of array2
return (sorted(array1) == sorted([i ** 2 for i in array2])) or (sorted(array2) == sorted([i ** 2 for i in array1]))

# Example usage:
print(comp([1, 2, 3, 4], [1, 4, 9, 16]))



if array1 is None and array2 is not None:
return False


if (sorted(array1) == sorted([i ** 2 for i in array2])) and (sorted(array2) == sorted([i ** 2 for i in array1])):
if (sorted(array1) == sorted([i ** 2 for i in array2])) or (sorted(array2) == sorted([i ** 2 for i in array1])):
return True

return False


comp([1,2,3,4], [1,4,9,16])
lis1=eval(input("Enter list 1: "))
lis2=eval(input("Enter list 2: "))
print(comp(lis1,lis2))

3 changes: 2 additions & 1 deletion FunProjects/rockPaperSiss.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import random
def rock_paper_scissors():
print("Welcome to Rock, Paper, Scissors!")
choices = ["rock", "paper", "scissors"]
Expand Down Expand Up @@ -38,4 +39,4 @@ def main():
else:
print("Invalid choice! Please try again.")

main()
main()
11 changes: 8 additions & 3 deletions FunProjects/snakeLadder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ def snake_and_ladder():
position = 0
while position != 100:
dice = random.randint(1, 6)
position += dice
if position == 50: # Climbing a ladder
if position + dice <= 100:
position += dice
if position == 50:
position = 75
elif position == 25: # Snake bite
elif position == 25:
position = 10


print(f"Dice: {dice}, Position: {position}")
if position == 100:
print("You won!!")

snake_and_ladder()
10 changes: 2 additions & 8 deletions problems/easy/easy_q1.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@

num = int(input("Enter a number: "))


if (num % 2) == 0:
print("{0} is Even".format(num))
else:
print("{0} is Odd".format(num))

if (num % 2) != 0:
print("{0} is Odd".format(num))
else:
print("{0} is Even".format(num))




9 changes: 9 additions & 0 deletions problems/easy/easy_q10.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Check Palindrome Number: Use a do-while loop to determine if a given number is a palindrome
def is_palindrome(num):
original = num

reverse = 0
while num != 0:
reverse = reverse * 10 + num % 10
num //= 10

return reverse == original

reverse = ''
while num != 0 :
reverse += str(num % 10)
Expand All @@ -9,6 +17,7 @@ def is_palindrome(num):
return "It is a Palindrome"
else:
return "It is not a Palindrome"

if __name__ == "__main__":
nums = int(input("Enter the Number: "))
res = is_palindrome(nums)
Expand Down
9 changes: 9 additions & 0 deletions problems/easy/easy_q11.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ def day_of_week(day):
}
return switch[day]
if __name__ == "__main__":

day=int(input("Enter the number : "))
if 0<day<8:
xcd = day_of_week(day)
print(xcd)
else:
print("Enter a valid input :")

day=int(input("Enter The Number:"))
if str(day) in "1234567":
xcd = day_of_week(day)
print(xcd)
else:
print("Enter Valid Input")


7 changes: 5 additions & 2 deletions problems/easy/easy_q12.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ def calculator(a, b, operator):
'*': a * b,
'/': a / b
}
return switch.get(operator, "Invalid Operator")
return switch.get(operator , "Invalid Operator")

if __name__ == "__main__":
n1 = int(input("Enter the Number 1 :"))
n2 = int(input("Enter the Number 2 :"))
opr = input("Enter the Operator :")
result = calculator(n1,n2,opr)
print(result)
print(result)

print(result)

23 changes: 4 additions & 19 deletions problems/easy/easy_q2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,17 @@
def largest_of_two(a, b):
if a > b:

print(num1,"larger")
else:
print(num2,"larger")

if __name__ == "__main__":
num1 = int(input("Enter the First Number :"))
num2 = int(input("Enter the Second :"))
res = largest_of_two(num1,num1)
print(res)


return a

return a

else:
return b
if __name__ == "__main__":
num1 = int(input("Enter the First Number :"))
num2 = int(input("Enter the Second Number :"))
res = largest_of_two(num1,num2)
keerthi
print("The Largest Number is",res)

print(res)


main

print(num1,"larger")
else:
print(num2,"larger")

16 changes: 11 additions & 5 deletions problems/easy/easy_q3.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Leap Year or Not: Write a program to determine whether a given year is a leap year.
def is_leap_year(year):


if year % 4 == 0:
if year % 100 == 0:
return "Not a Leap Year"
Expand All @@ -9,11 +10,16 @@ def is_leap_year(year):
return "Leap Year"

if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:


return "Leap Year"
return "Not a Leap Year"

if __name__ == "__main__":

num = int(input("Enter the number :"))
res = is_leap_year(num)
print(res)
return " Leap Year"
else:
return "not a Leap Year"


return "Leap Year"
return "Not a Leap Year"

16 changes: 7 additions & 9 deletions problems/easy/easy_q4.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
# Positive, Negative, or Zero: Accept a number and check if it is positive, negative, or zero.

num = int(input("Enter the Number : "))

def check_number(num):

if num < 0:
print("Negative")
elif num > 0:
print("Positive")
else:
keerthi

print("Number is Zero")

if __name__ == "__main__":
num = int(input("Enter the Number : "))
check_number(num)

print("Number is zero")

if __name__ == "__main__":
num = int(input("Enter the Number : "))
res = check_number(num)
print(res)
main




11 changes: 10 additions & 1 deletion problems/easy/easy_q5.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ def grade_system(marks):
elif marks >= 70:
return "C"
else:

return "F"

if __name__ == "__main__":
mark = int(input("Enter the Mark : "))
res = grade_system(mark)


return "D"


if __name__ == "__main__":
num = int(input("Enter the Mark : "))
res = grade_system(num)
print(res)

8 changes: 6 additions & 2 deletions problems/easy/easy_q6.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ def print_numbers(n):
i = 1
while i <= n:
print(i)
i += 1


if __name__ == "__main__":
num = int(input("Enter the Number "))
print_numbers(num)


num = int(input("Enter the Number :"))
print_numbers(num)

16 changes: 15 additions & 1 deletion problems/easy/easy_q7.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
# Sum of Digits: Write a program to calculate the sum of digits of a number using a while loop.
def sum_of_digits(num):
def sum_of_digits(num):
total = 0
while num > 0:
total += num % 10

num = num // 10


num = num // 10

num //= 10


return total

if __name__ == "__main__":
num = int(input("Enter the Number : "))

res=sum_of_digits(num)
print(res)





7 changes: 5 additions & 2 deletions problems/easy/easy_q9.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ def factorial(n):

if __name__ == "__main__":
num = int(input("Enter the Number :"))
res=factorial(num)
print(res)

print(factorial(num))

res=factorial(num)
print(res)

Loading