Check if Country Belongs to BRICS List
Write a Python program to initialize a list containing the names of BRICS countries, accept a country name from the user, and verify whether it is part of BRICS.
Questions on top, code solution screenshots directly below. Click any image to expand.
Write a Python program to initialize a list containing the names of BRICS countries, accept a country name from the user, and verify whether it is part of BRICS.
Write a Python program to traverse a list containing duplicate items and display the frequency (occurrence count) of every distinct element.
Write a Python program to take a target number from the user and count how many items in a predefined list of numbers are strictly greater than that number.
Write a Python program to remove all duplicate elements from a list, preserving only unique values in the order of their first appearance.
Write a Python program to read or define two separate lists and create a new list containing only the elements common to both.
Write a Python program to compare two lists and print elements that are present in the first list but absent from the second list.
Write a Python program to find and display the maximum and minimum numbers from a given list of numerical values.
Write a Python program to accept a list of integers from the user, test each number for primality, and extract all prime numbers into a separate list.
Write a Python program to search for a specified element in a list and display its immediate predecessor (previous item) and successor (next item).
Write a Python program to compute the first 10 terms of the Fibonacci sequence and store them into a list, printing the resulting sequence.
Write a Python program to generate a list containing squares of all integers from 1 up to 20 using a loop or list comprehension.
Write a Python program taking two equal-length numerical lists, adding corresponding elements at each index position, and storing the resulting sums in a third list.
Write a Python script demonstrating foundational list operations: appending, inserting, popping, slicing, and index referencing on heterogeneous elements.
Write a Python program to populate a list of integers from user input, iterate through the list, and display only the even numbers.
Write a Python program to read numerical list items from the user and arrange them in ascending order using list sorting methods or a sorting algorithm.
Write a Python program to accept a series of string words into a list and print them sorted in alphabetical (lexicographical) order.
Write a Python program to traverse a numerical list and replace every negative number with zero (or its positive absolute equivalent), updating the original list.
Write a Python program to take a mixed list of positive and negative integers and partition them into two separate lists: one for positive values and another for negative values.
Write a Python program to circularly shift all elements of a list one position to the right, moving the last element to the first index position.
Write a Python program to calculate and display the total sum of all even numbers and the total sum of all odd numbers in a list separately.
Write a Python program that accepts a series of inputs from the user and constructs a new list containing only unique items, ignoring duplicates as they are entered.