Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
34 views

Python Questions

Uploaded by

Hardik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Python Questions

Uploaded by

Hardik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1.

Execute the python program to check whether the input string is a


palindrome or not.
2. Execute the program to find the factorial of a number.

3. Execute a program to print a Fibonacci series.


4. Execute the program to check whether a number is an Armstrong number or
not.

5. Execute the program to create a calculator


6. Print a pyramid and a half pyramid pattern using the asterisk in a program.

7. Print a pyramid and a half pyramid pattern using the asterisk in a program.

8. program to check if a year is a leap year or not?


9. Execute the program to check if the number is a prime number or not.
10.Program to Find Even Numbers between 100 to 1000

11.Program to Find Odd Numbers between 100 to 1000


12.Write a Python program which accepts the radius of a circle from the user
and compute the area.

13. Write a Python program which accepts the user's first and last name and
print them with a space between them. Also count vowels in those names.
14.Write a Python program to get the difference between a given number and
17, if the number is greater than 17 return double the absolute difference

15.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.
16.Write a Python program to test whether a passed letter is a vowel or not

17.Write a Python program that will accept the base and height of a triangle and
compute the area.
18.Write a Python program to sum of three given integers. However, if two
values are equal sum will be zero

19.Write a Python program to sum of two given integers. However, if the sum
is between 15 to 20 it will return 20.
20.Write a Python program to display your details like name, age, address in
three different lines.

21.Write a Python program to sum of the first n positive integers


22.Write a Python program to calculate sum of digits of a number.

23.Write a Python program to sort three integers without using conditional


statements and loops.
24.Write a Python program to count the number occurrence of a specific
character in a string

25.Write a Python program to swap two variables.


26.Write a Python program to check if a number is positive, negative or zero.

27.Given two integer numbers return their product only if the product is equal
to or lower than 1000, else return their sum.
28.Write a program to display the first 10 numbers and in each iteration, print
the sum of the current and previous number.

29.Display numbers divisible by 5 from a 1 to 50


30.Print the following pattern

31.Print multiplication table for 7


32.Print downward Half-Pyramid Pattern with Star

33.Print first 10 numbers using a for loop


34.Print sum of all even numbers from 10 to 20

35.Calculate the square of each number from 1 to 10

36.Python Program to Find the Largest Among Three Numbers

37.Python Program to Check Armstrong Number


38.Python Program to Find the Sum of Natural Numbers

39.Python Program to Reverse a Number


40.Python program to check whether the given integer is a multiple of 5

41.Python program to check whether the given integer is a multiple of


both 5 and 7
42.Python program to find the average of 10 numbers using while loop
43.Python program to display all the multiples of 3 within the range 10
to 50
44.Python program to display all integers within the range 100-200
whose sum of digits is an even number

45.Python program to generate the prime numbers from 1 to N


46.What is printed by the following code fragment?
a=0
while a < 100:
print(a)
a += 1
print()
What is the output for the above code as well as do this program using for
loop instead of while loop

47.Write a program that asks the user to enter a weight in kilograms. The
program should convert it to pounds
48.Ask the user to enter a year, determine how many leap years there have
been between 1600 and that year.

49.Write a program that asks the user to enter a length in centimeters. If the user
enters a negative length, the program should tell the user that the entry is
invalid. Otherwise, the program should convert the length to inches and print
out the result.
50.Write a program which will find the numbers divisible by 7 but not divisible
by 5

You might also like