The Joy of Computing using Python - July 2026
Please scroll down for latest Programs 👇
Code compiled and tested successfully!
Due date on 2026-08-14, 23:59 IST
Complete Program
# --- START OF SOLUTION CODE ---
times = list(map(float, input().split()))
print(min(times))
# --- END OF SOLUTION CODE ---
Code Snippet to Paste in the Editor
# --- START OF SOLUTION CODE ---
times = list(map(float, input().split()))
print(min(times))
# --- END OF SOLUTION CODE ---
This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
Due date on 2026-08-14, 23:59 IST
Complete Program
# --- START OF SOLUTION CODE ---
temps = input().split()
print(sum(int(float(x)) for x in temps))
# --- END OF SOLUTION CODE ---
Code Snippet to Paste in the Editor
# --- START OF SOLUTION CODE ---
temps = input().split()
print(sum(int(float(x)) for x in temps))
# --- END OF SOLUTION CODE ---
This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
Due date on 2026-08-14, 23:59 IST
Complete Program
# --- START OF SOLUTION CODE ---
weights = list(map(float, input().split()))
avg = sum(weights) / len(weights)
print(sum(1 for w in weights if w > avg))
# --- END OF SOLUTION CODE ---
Code Snippet to Paste in the Editor
# --- START OF SOLUTION CODE ---
weights = list(map(float, input().split()))
avg = sum(weights) / len(weights)
print(sum(1 for w in weights if w > avg))
# --- END OF SOLUTION CODE ---
This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
Due date on 2026-08-20, 23:59 IST
Complete Program
# --- START OF SOLUTION CODE ---
# Read space-separated integers representing temperature readings
temperatures = list(map(int, input().split()))
# Calculate temperature range (highest - lowest)
temp_range = max(temperatures) - min(temperatures)
# Print the result
print(temp_range)
# --- END OF SOLUTION CODE ---
Code Snippet to Paste in the Editor
# --- START OF SOLUTION CODE ---
temperatures = list(map(int, input().split()))
temp_range = max(temperatures) - min(temperatures)
print(temp_range)
# --- END OF SOLUTION CODE ---This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
Due date on 2026-08-20, 23:59 IST
Complete Program
# --- START OF SOLUTION CODE ---
def is_prime(n):
if n <= 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
n = int(input().strip())
print(is_prime(n))
# --- END OF SOLUTION CODE ---
Code Snippet to Paste in the Editor
# --- START OF SOLUTION CODE ---
def is_prime(n):
if n <= 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
n = int(input().strip())
print(is_prime(n))
# --- END OF SOLUTION CODE ---This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
Due date on 2026-08-20, 23:59 IST
Complete Program
# --- START OF SOLUTION CODE ---
# Read space-separated product IDs
product_ids = input().split()
# Check if any product ID appears more than once
has_duplicates = len(product_ids) != len(set(product_ids))
# Print True if duplicates exist, otherwise False
print(has_duplicates)
# --- END OF SOLUTION CODE ---
Code Snippet to Paste in the Editor
# --- START OF SOLUTION CODE ---
product_ids = input().split()
has_duplicates = len(product_ids) != len(set(product_ids))
print(has_duplicates)
# --- END OF SOLUTION CODE ---This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
Due date on 2026-08-27, 23:59 IST
Complete Program
# --- START OF SOLUTION CODE ---
# Read space-separated integers
nums = list(map(int, input().split()))
# Count frequency of each number
counts = {}
for num in nums:
counts[num] = counts.get(num, 0) + 1
# Find the number with the highest frequency; if tied, pick the smallest number
result = min(counts.keys(), key=lambda x: (-counts[x], x))
# Print the result
print(result)
# --- END OF SOLUTION CODE ---
Code Snippet to Paste in the Editor
# --- START OF SOLUTION CODE ---
nums = list(map(int, input().split()))
counts = {}
for num in nums:
counts[num] = counts.get(num, 0) + 1
result = min(counts.keys(), key=lambda x: (-counts[x], x))
print(result)
# --- END OF SOLUTION CODE ---This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
Due date on 2026-08-27, 23:59 IST
Complete Program
# --- START OF SOLUTION CODE ---
# Read space-separated sequence of integers
nums = list(map(int, input().split()))
# Count occurrences of each number while preserving first-appearance order
counts = {}
for num in nums:
counts[num] = counts.get(num, 0) + 1
# Filter for numbers occurring more than once
duplicates = [num for num in counts if counts[num] > 1]
# Print result in order of first appearance, or -1 if no duplicates
if duplicates:
print(*duplicates)
else:
print(-1)
# --- END OF SOLUTION CODE ---
Code Snippet to Paste in the Editor
# --- START OF SOLUTION CODE ---
nums = list(map(int, input().split()))
counts = {}
for num in nums:
counts[num] = counts.get(num, 0) + 1
duplicates = [num for num in counts if counts[num] > 1]
if duplicates:
print(*duplicates)
else:
print(-1)
# --- END OF SOLUTION CODE ---This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
Due date on 2026-08-27, 23:59 IST
Complete Program
# --- START OF SOLUTION CODE ---
# Read space-separated sequence of integers
nums = list(map(int, input().split()))
# Count frequency of each number
counts = {}
for num in nums:
counts[num] = counts.get(num, 0) + 1
# Filter for numbers that occur exactly two times
exact_two = [num for num, count in counts.items() if count == 2]
# Sort the numbers in increasing order
exact_two.sort()
# Print result or -1 if no such number exists
if exact_two:
print(*exact_two)
else:
print(-1)
# --- END OF SOLUTION CODE ---
Code Snippet to Paste in the Editor
# --- START OF SOLUTION CODE ---
nums = list(map(int, input().split()))
counts = {}
for num in nums:
counts[num] = counts.get(num, 0) + 1
exact_two = [num for num, count in counts.items() if count == 2]
exact_two.sort()
if exact_two:
print(*exact_two)
else:
print(-1)
# --- END OF SOLUTION CODE ---This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
Due date on 2026-09-03, 23:59 IST
Complete Program
def count_alpha(s):
if not s:
return 0
return (1 if s[0].isalpha() else 0) + count_alpha(s[1:])
if __name__ == "__main__":
s = input()
print(count_alpha(s))
Code Snippet to Paste in the Editor
def count_alpha(s):
if not s:
return 0
return (1 if s[0].isalpha() else 0) + count_alpha(s[1:])
s = input()
print(count_alpha(s))This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
Due date on 2026-09-03, 23:59 IST
Complete Program
def count_boxes(lst):
if not lst:
return 0
return 1 + count_boxes(lst[1:])
if __name__ == "__main__":
boxes = input().split()
print(count_boxes(boxes))
Code Snippet to Paste in the Editor
def count_boxes(lst):
if not lst:
return 0
return 1 + count_boxes(lst[1:])
boxes = input().split()
print(count_boxes(boxes))This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
Due date on 2026-09-03, 23:59 IST
Code Snippet to Paste in the Editor
def find_max(lst):
if len(lst) == 1:
return int(lst[0])
first = int(lst[0])
rest_max = find_max(lst[1:])
return first if first > rest_max else rest_max
temps = input().split()
print(find_max(temps))This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
Due date on 2026-09-10, 23:59 IST
Complete Program
# --- START OF SOLUTION CODE ---
n = int(input().strip())
attractions = {}
for _ in range(n):
line = input().strip()
name, rating = line.rsplit(' ', 1)
attractions[name] = rating
search_name = input().strip()
print(attractions.get(search_name, -1))
# --- END OF SOLUTION CODE ---
Code Snippet to Paste in the Editor
# --- START OF SOLUTION CODE ---
n = int(input().strip())
attractions = {}
for _ in range(n):
line = input().strip()
name, rating = line.rsplit(' ', 1)
attractions[name] = rating
search_name = input().strip()
print(attractions.get(search_name, -1))
# --- END OF SOLUTION CODE ---This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
Due date on 2026-09-10, 23:59 IST
Complete Program
# --- START OF SOLUTION CODE ---
n = int(input().strip())
landmarks = input().strip().split()
target = input().strip()
print(landmarks.index(target) if target in landmarks else -1)
# --- END OF SOLUTION CODE ---
Code Snippet to Paste in the Editor
# --- START OF SOLUTION CODE ---
n = int(input().strip())
landmarks = input().strip().split()
target = input().strip()
print(landmarks.index(target) if target in landmarks else -1)
# --- END OF SOLUTION CODE ---This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
Due date on 2026-09-10, 23:59 IST
Complete Program
# --- START OF SOLUTION CODE ---
numbers = list(map(int, input().split()))
numbers.sort()
print(numbers[-2])
# --- END OF SOLUTION CODE ---
Code Snippet to Paste in the Editor
# --- START OF SOLUTION CODE ---
numbers = list(map(int, input().split()))
numbers.sort()
print(numbers[-2])
# --- END OF SOLUTION CODE ---This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.
Evaluation Results
Note: These tests may not be considered while scoring.
No comments:
Post a Comment
Keep your comments reader friendly. Be civil and respectful. No self-promotion or spam. Stick to the topic. Questions welcome.