From 3d1f6e19dd902b662d3b8717db489ca7cca05a7e Mon Sep 17 00:00:00 2001 From: Aakriti582 Date: Sat, 30 May 2026 23:50:03 +0545 Subject: [PATCH] Task submission --- Students/Aakriti/Python/args.py | 31 +++++++++++++++++++++++++ Students/Aakriti/Python/circle.py | 13 +++++++++++ Students/Aakriti/Python/greet.py | 8 +++++++ Students/Aakriti/Python/largest.py | 12 ++++++++++ Students/Aakriti/Python/product.py | 13 +++++++++++ Students/Aakriti/Python/square.py | 6 +++++ Students/Aakriti/Python/studentmarks.py | 15 ++++++++++++ 7 files changed, 98 insertions(+) create mode 100644 Students/Aakriti/Python/args.py create mode 100644 Students/Aakriti/Python/circle.py create mode 100644 Students/Aakriti/Python/greet.py create mode 100644 Students/Aakriti/Python/largest.py create mode 100644 Students/Aakriti/Python/product.py create mode 100644 Students/Aakriti/Python/square.py create mode 100644 Students/Aakriti/Python/studentmarks.py diff --git a/Students/Aakriti/Python/args.py b/Students/Aakriti/Python/args.py new file mode 100644 index 0000000..6479ae2 --- /dev/null +++ b/Students/Aakriti/Python/args.py @@ -0,0 +1,31 @@ +# 4. Function with *args +# Write a function student_marks multiple subjects that returns: + +# # total marks +# # average marks +def student_marks(*args): + print(args) + marks=sum(args) + average_marks= marks/len(args) + return marks, average_marks + + +total, average=student_marks(50,50,50,50) +print("Total marks=",total) +print("Average=", average) + + +# Function with **kwargs +# Write a function student(**details) that prints all key-value pairs. + +def student(**details): + print(details) + for key, value in details.items(): + print(f"{key}:{value}") + +student( + Name ="Aakriti", + age=19, + club='Software' + +) \ No newline at end of file diff --git a/Students/Aakriti/Python/circle.py b/Students/Aakriti/Python/circle.py new file mode 100644 index 0000000..2e1bdaf --- /dev/null +++ b/Students/Aakriti/Python/circle.py @@ -0,0 +1,13 @@ +#Write a function circle(radius) that returns: +# area +# circumference +import math +def circle(radius): + area=math.pi*radius**2 + circum=2*math.pi*radius + + return area,circum + +AreaOfCircle, PeriOfCircle=circle(24) +print(f"The area of given circle is : {round(AreaOfCircle,2)}") +print(f" The circumference of circle is : {round(PeriOfCircle,2)}") \ No newline at end of file diff --git a/Students/Aakriti/Python/greet.py b/Students/Aakriti/Python/greet.py new file mode 100644 index 0000000..d91ac29 --- /dev/null +++ b/Students/Aakriti/Python/greet.py @@ -0,0 +1,8 @@ +# Create a function that greets users, but if no name is provided, it greets "Guest". + +def greeting(name="Guest"): + name=name.strip() or "Guest" + print("Hello, " + name + "! Welcome to the Python programming course.") + +user_name=input("Enter your name: ") +greeting(user_name) \ No newline at end of file diff --git a/Students/Aakriti/Python/largest.py b/Students/Aakriti/Python/largest.py new file mode 100644 index 0000000..ff03ef8 --- /dev/null +++ b/Students/Aakriti/Python/largest.py @@ -0,0 +1,12 @@ +# Create a function that finds the largest number using *args + +def largest(*args): + lar=0 + for x in args: + if x >lar: + lar=x + print(f"The largest number is :{lar}") + + + +largest(1,2,30,400,5,6,7) \ No newline at end of file diff --git a/Students/Aakriti/Python/product.py b/Students/Aakriti/Python/product.py new file mode 100644 index 0000000..2bc8a2d --- /dev/null +++ b/Students/Aakriti/Python/product.py @@ -0,0 +1,13 @@ +#Create a function that accepts product details using **kwargs name ,price and quantity and prints them in a formatted way. + +def product(**details): + for key,value in details.items(): + + # print(f"The Detils of your product are {key}: {value}") + print(f"{key}: {value}") +print("The details of your products are below :") +product( + Name="Cookies", + Price=250, + Quantity=3 +) \ No newline at end of file diff --git a/Students/Aakriti/Python/square.py b/Students/Aakriti/Python/square.py new file mode 100644 index 0000000..36d9c20 --- /dev/null +++ b/Students/Aakriti/Python/square.py @@ -0,0 +1,6 @@ +# hw:Create a function square(num) that returns the square of a number. + +def square(num): + return num**2 + +print(square(4)) \ No newline at end of file diff --git a/Students/Aakriti/Python/studentmarks.py b/Students/Aakriti/Python/studentmarks.py new file mode 100644 index 0000000..d8171d7 --- /dev/null +++ b/Students/Aakriti/Python/studentmarks.py @@ -0,0 +1,15 @@ +# 2.Write a function student_marks(math, science) that returns: + +# total marks +# average marks + +def student_marks(math,science): + total_marks=math+science + average_marks=total_marks/2 + return total_marks,average_marks + +math_marks=int(input("Enter marks for Math: ")) +science_marks=int(input("Enter marks for Science: ")) +total, average = student_marks(math_marks,science_marks) +print(f"Total marks: {total}") +print(f"Average marks: {average}") \ No newline at end of file