From 47cf47bb98e6e41fa0f4fb970bc3d1a4261c1e22 Mon Sep 17 00:00:00 2001 From: MUKILVELAN007 Date: Fri, 6 Dec 2024 13:42:22 +0530 Subject: [PATCH 1/9] resolving leap prob --- problems/easy/easy_q3.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/problems/easy/easy_q3.py b/problems/easy/easy_q3.py index 8df3340..953e617 100644 --- a/problems/easy/easy_q3.py +++ b/problems/easy/easy_q3.py @@ -1,8 +1,9 @@ # 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 and year % 100 != 0 or year % 400 == 0: - return "Not a Leap Year" - return "Leap Year" + if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0): + return "Leap Year" + else: + return "Not a Leap Year" if __name__ == "__main__": num = int(input("Enter the number :")) From fec59e8e8e4936818d6f310e0c43c3734a456694 Mon Sep 17 00:00:00 2001 From: MUKILVELAN007 Date: Fri, 6 Dec 2024 13:51:27 +0530 Subject: [PATCH 2/9] resolving largest num --- problems/easy/easy_q2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/problems/easy/easy_q2.py b/problems/easy/easy_q2.py index 8c49830..ec4d7b3 100644 --- a/problems/easy/easy_q2.py +++ b/problems/easy/easy_q2.py @@ -1,11 +1,11 @@ # Find the Largest Number: Accept two numbers and print the larger one. def largest_of_two(a, b): if a > b: - return b + return a else: - return a + return b if __name__ == "__main__": num1 = int(input("Enter the First Number :")) num2 = int(input("Enter the Second Number :")) - res = largest_of_two(num1,num1) + res = largest_of_two(num1,num2) print(res) \ No newline at end of file From 2a1a7618fbbdb412c60b45aca3e348c77c71843d Mon Sep 17 00:00:00 2001 From: MUKILVELAN007 Date: Fri, 6 Dec 2024 13:57:51 +0530 Subject: [PATCH 3/9] resolving add or even --- problems/easy/easy_q1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/easy/easy_q1.py b/problems/easy/easy_q1.py index 546c19b..50fa9f4 100644 --- a/problems/easy/easy_q1.py +++ b/problems/easy/easy_q1.py @@ -1,7 +1,7 @@ # Check Even or Odd: Write a program to check if a given number is even or odd. num = int(input("Enter a number: ")) -if (num / 2) != 0: +if (num % 2) != 0: print("{0} is Odd".format(num)) else: print("{0} is Even".format(num)) From 97111f4f68fc90133833300312a80e84684a6916 Mon Sep 17 00:00:00 2001 From: MUKILVELAN007 Date: Fri, 6 Dec 2024 14:05:02 +0530 Subject: [PATCH 4/9] check whether the given number is positive,negetive,or zero --- problems/easy/easy_q4.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/problems/easy/easy_q4.py b/problems/easy/easy_q4.py index 8b1dc9d..f0489f7 100644 --- a/problems/easy/easy_q4.py +++ b/problems/easy/easy_q4.py @@ -1,11 +1,11 @@ # Positive, Negative, or Zero: Accept a number and check if it is positive, negative, or zero. def check_number(num): if num > 0: - print("Negative") + print("positive") elif num < 0: - print("Positive") + print("negetive") else: - print("Number is negative") + print("zero") if __name__ == "__main__": num = input("Enter the Number : ") From f055646e92b1095581842f4d6f13d79d6b69e0c9 Mon Sep 17 00:00:00 2001 From: MUKILVELAN007 Date: Fri, 6 Dec 2024 14:20:00 +0530 Subject: [PATCH 5/9] Grading system --- problems/easy/easy_q5.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/problems/easy/easy_q5.py b/problems/easy/easy_q5.py index fbfab0b..448e6b2 100644 --- a/problems/easy/easy_q5.py +++ b/problems/easy/easy_q5.py @@ -2,13 +2,13 @@ def grade_system(marks): if marks >= 90: - return "B" - elif marks >= 80: - return "A" - elif marks >= 70: - return "F" + return "A" + elif marks >= 80 and marks<90: + return "B" + elif marks >= 70 and marks<80: + return "C" else: - return "C" + return "F" if __name__ == "__main__": num = input("Enter the Mark : ") From a26bff32f0e2e6750c45b688c05382532594a024 Mon Sep 17 00:00:00 2001 From: MUKILVELAN007 Date: Fri, 6 Dec 2024 14:39:15 +0530 Subject: [PATCH 6/9] Grading system --- problems/easy/easy_q5.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/problems/easy/easy_q5.py b/problems/easy/easy_q5.py index 448e6b2..486e8f1 100644 --- a/problems/easy/easy_q5.py +++ b/problems/easy/easy_q5.py @@ -3,15 +3,15 @@ def grade_system(marks): if marks >= 90: return "A" - elif marks >= 80 and marks<90: + elif marks >= 80: return "B" - elif marks >= 70 and marks<80: + elif marks >= 70: return "C" else: return "F" if __name__ == "__main__": - num = input("Enter the Mark : ") - res = grade_system(num) + mark = int(input("Enter the Mark : ")) + res = grade_system(mark) print(res) From e5466f6e52c2b36b420c8db873910df031a6c9a3 Mon Sep 17 00:00:00 2001 From: MUKILVELAN007 Date: Fri, 6 Dec 2024 14:40:57 +0530 Subject: [PATCH 7/9] Numbers from 1 to n --- problems/easy/easy_q6.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/easy/easy_q6.py b/problems/easy/easy_q6.py index 3ac65c7..1b137fc 100644 --- a/problems/easy/easy_q6.py +++ b/problems/easy/easy_q6.py @@ -3,7 +3,7 @@ def print_numbers(n): i = 1 while i <= n: print(i) - n -= 1 + i+= 1 if __name__ == "__main__": num = int(input("Enter the Number ")) From af798e9d46ed07b5295263b036348b636ac5b40e Mon Sep 17 00:00:00 2001 From: MUKILVELAN007 Date: Fri, 6 Dec 2024 15:18:38 +0530 Subject: [PATCH 8/9] sum of digits --- problems/easy/easy_q7.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/problems/easy/easy_q7.py b/problems/easy/easy_q7.py index 8efa72e..0ed3395 100644 --- a/problems/easy/easy_q7.py +++ b/problems/easy/easy_q7.py @@ -1,12 +1,12 @@ # 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 return total if __name__ == "__main__": num = int(input("Enter the Number : ")) - + print(sum_of_digits(num)) From cc1d2fe65131ca78038c23e120c682fdb305d567 Mon Sep 17 00:00:00 2001 From: MUKILVELAN007 Date: Fri, 6 Dec 2024 16:06:41 +0530 Subject: [PATCH 9/9] mathemeticl operation --- problems/medium/m1.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/problems/medium/m1.py b/problems/medium/m1.py index dddb03c..cc67a80 100644 --- a/problems/medium/m1.py +++ b/problems/medium/m1.py @@ -10,7 +10,8 @@ def math_operations_menu(): print("5. Modulo") choice = int(input("Enter your choice: ")) - a, b = map(int, input("Enter two numbers: ").split()) + a=int(input("Enter a num1:")) + b=int(input("Enter a num2:")) if choice == 1: print("Subtraction:", a - b) @@ -24,3 +25,4 @@ def math_operations_menu(): print("Modulo:", a // b) else: print("Invalid option") +math_operations_menu()