Write a Python program prints out the unique elements of a list
lst in a sorted...
Write a Python program prints out the unique elements of a list
lst in a sorted manner (i.e it removes duplicates from the list).
For example, if list is [10,20,30,20,10,50,60,40,80,50,40], the
output should be [10, 20, 30, 40, 50, 60, 80].?
PYTHON 3
Write a program that prints the count of all prime numbers
between A and...
PYTHON 3
Write a program that prints the count of all prime numbers
between A and B (inclusive), where A and B are defined as
follows:
A = 21212
B = A + 5000
Just a recap on prime numbers: A prime number is any number,
greater or equal to 2, that is divisible ONLY by 1 and itself. Here
are the first 10 prime numbers: 2, 5, 7, 11, 13, 17, 19, 23, and
29.
Rules:
You should first...
Write a Python program that reads in the month, day, and year
of a date and...
Write a Python program that reads in the month, day, and year
of a date and prints it in the
dd/mm/yyyy format or mm/dd/yyyy format, the format depending
on the user’s preference. The
program also prints the message
It is a magic date
If the product of month and day is equal to the last two
digits of the year. For example, April 20
1980 is a magic date because April (numeric value 4)
multiplied by 20 is equal to...
write a program in python for following
x = { 'a' : 1 , 'b':2 ,...
write a program in python for following
x = { 'a' : 1 , 'b':2 , 'c':3, 'd':4 }
For the following key,value pairs of dictionary display those
which are even values i.e for which the value is even.
i am trying like this but getting confused.
(k:v for k,v in x.items() if v%2 != 0
TO BE DONE IN PYTHON: Write a function `lowest_integer()` which
takes 2 input arguments:
1)a function...
TO BE DONE IN PYTHON: Write a function `lowest_integer()` which
takes 2 input arguments:
1)a function `g` representing an increasing function
g(x)
2) a number `gmin`,
and returns an integer `nmin` such that
nmin>0
is the smallest integer that satisfies
g(nmin)>gmin.
test:
def g(n):
return 2*n
print(lowest_integer(g, 10))
Output: 6
write a python program that include a function named
activity_selection() and take in two arguments, first...
write a python program that include a function named
activity_selection() and take in two arguments, first one would be
the number of tasks and the second argument would be a list of
activities. Each activity would have an activity number, start time
and finish time.
Example activity_selection input and output:
activity_selection (11, [[1, 1, 4 ], [2, 3, 5], [3, 0, 6], [4,
5, 7], [5, 3, 9], [6, 5, 9],[7, 6, 10], [ 8, 8, 11], [ 9, 8,...