Python Practice Quesions

Posted by admin at September 15, 2019

Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5,
between 2000 and 3200 (both included).
The numbers obtained should be printed in a comma-separated sequence on a single line.

Write a program which can compute the factorial of a given numbers.

With a given integral number n, write a program to generate a dictionary that contains (i, i*i) such that is an integral number between 1 and n (both included). and then the program should print the dictionary.

Write a program that calculates and prints the value according to the given formula:
Q = Square root of [(2 * C * D)/H]

Write a program that accepts a comma separated sequence of words as input and prints the words in a comma-separated sequence after sorting them alphabetically.

Write a program, which will find all such numbers between 1000 and 3000 (both included) such that each digit of the number is an even number.

Write a program that accepts a sentence and calculate the number of letters and digits.

Write a program that accepts a sentence and calculate the number of upper case letters and lower case letters.

Write a program that computes the value of a+aa+aaa+aaaa with a given digit as the value of a.

Write a function that returns the maximum of two numbers.

Write a function called fizz_buzz that takes a number.

If the number is divisible by 3, it should return “Fizz”

If it is divisible by 5, it should return “Buzz”

If it is divisible by both 3 and 5, it should return “FizzBuzz”.

Otherwise, it should return the same number.

Write a function for checking the speed of drivers. This function should have one parameter: speed.

If speed is less than 70, it should print “Ok”.

Otherwise, for every 5km above the speed limit (70), it should give the driver one demerit point and print the total number of demerit points. For example,

if the speed is 80, it should print: “Points: 2”.

If the driver gets more than 12 points, the function should print: “License suspended”

Write a function called showNumbers that takes a parameter called limit. It should print all the numbers between 0 and limit with a label to identify the even and odd numbers. For example, if the limit is 3, it should print:
0 EVEN
1 ODD
2 EVEN
3 ODD


Write a function that returns the sum of multiples of 3 and 5 between 0 and limit (parameter). For example, if limit is 20, it should return the sum of 3, 5, 6, 9, 10, 12, 15, 18, 20.

Write a function that prints all the prime numbers between 0 and limit where limit is a parameter.

Write a function that prints all the prime numbers between 0 and limit where limit is a parameter.

Write a Python program to display the first and last colors from the following list
color_list = [“Red”,”Green”,”White” ,”Black”]

Write a Python program to calculate the sum of three given numbers, if the values are equal then return three times of their sum

Write a Python program to find whether a given number (accept from the user) is even or odd, print out an appropriate message to the user

Write a Python program to check whether a specified value is contained in a group of values.

Write a Python program that will accept the base and height of a triangle and compute the area.

Write a Python program to compute the greatest common divisor (GCD) of two positive integers

Write a Python program to sum of two given integers. However, if the sum is between 15 to 20 it will return 20

Write a Python program that will return true if the two given integer values are equal or their sum or difference is 5

Write a Python program to display your details like name, age, address in three different lines.

Write a Python program to solve (x + y) * (x + y)

Write a Python program to compute the future value of a specified principal amount, rate of interest, and a number of years

Write a Python program to sort three integers without using conditional statements and loops.

Write a Python program to sum of all counts in a collections?

Write a Python function that takes a sequence of numbers and determines if all the numbers are different from each other

Write a Python program to remove and print every third number from a list of numbers until the list becomes empty.

Write a Python program to find the number of zeros at the end of a factorial of a given positive number.


Comments

Write a Reply or Comment

Your email address will not be published. Required fields are marked *