Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a python program that takes 10 numbers from the user and prints the numbers in
reverse order.
Sample input:
1
2
3
4
5
6
7
8
9
10
Sample output:
10 9 8 7 6 5 4 3 2 1
Write a python program that prints the following sequence using for/while loop. The
outputs should be shown exactly as the pattern below:
a) 24, 18, 12, 6, 0, -6
b) -10, -5, 0, 5, 10, 15, 20
c) 18, 27, 36, 45, 54, 63
d) 63, 54, 45, 36, 27, 18
Profit Information to be printed
•No profit Super flop movie!!
•Less than 500000 (5 lakh) Flop movie! Waste of money. Waste of time.
•Greater than 5 lakh and
less than 20 lakh Average movie
•Above 20 lakh Success!!
•Above 30 lakh Super Hit!!!

Sample Input 1:
50000
1000000
800000
Sample Output 1:
Profit: 1750000
Average movie
Take an hour from the user as input and tell it is time for which meal.
• The user will input the number in a 24-hour format. So, 14 means 2 pm, 3 means 3
am, 18 means 6 pm, etc.
• Valid inputs are 0 to 23. Inputs less than 0 or more than 23 are invalid in 24-hour clock.
• Assume, Input will be whole numbers. For example, 3.5 will NOT be given as input.
==========================================================
Inputs: Message to be printed
4 to 6: Breakfast
12 to 13: Lunch
16 to 17: Snacks
19 to 20: Dinner
For all other valid inputs, say "Patience is a virtue"
For all other invalid inputs, say "Wrong time"
==========================================================
Sample Input:
4
Sample output:
Breakfast
Sample Input:
27
Sample output:
Wrong time
Write a python program that takes three numbers from the user and returns the middle
of the three numbers, i.e., the number which is not the smallest and not the largest. You
can assume that the three numbers are different.
Sample Input:
Number 1: 12
Number 2: 90
Number 3: 67
Sample Output:
67

You are given the temperature T of an object in one of Celsius, Fahrenheit, and Kelvin scales. Write a program to print T in all scales viz Celsius, Fahrenheit, and Kelvin. Formula to convert from Fahrenheit F to Celsius C is C = (F - 32) * 5 / 9. Formula to convert from Kelvin K to Celsius C is C = K - 273


Striped Rectangle

Given an integer number M, N as input. Write a program to print a striped rectangular pattern of M rows and N columns using (+ and -) character.

Input

The first line of input is an integer M. The second line of input is an integer N.

Explanation

In the given example the striped rectangular pattern of

7 rows and 5 columns. Therefore, the output should be

+ + + + +

- - - -

+ + + + +

- - - - -

+ + + + +

- - - - -

+ + + + +


Sample Input 1

5

7

Sample Output 1

+ + + + + + +

- - - - - - -

+ + + + + + +

- - - - - - -

+ + + + + + +

Sample Input 2

7

5

Sample Output 2

+ + + + +

- - - - -

+ + + + +

- - - - -

+ + + + +

- - - - -

+ + + + +




Composite Number

Given an integer N, write a program to find if the given number is a composite number or not. If it is composite, print True or else print False.

Input

The first line of input is an integer N.

Output

The output should be True or False.

Explanation

In the given example,

12 is a composite number as it can be divisible by 1, 2, 3, 4, 6, 12.Therefore, the output should be

True.

Sample Input 1

12

Sample Output 1

True

Sample Input 2

3

Sample Output 2

False




Sum of Odd Numbers

Write a program to find the sum of odd numbers in first N natural numbers.

Input

The input is an integer N.

Output

The output should be an integer containing the sum of odd numbers up to the given number.

Explanation

In the given example sum of odd numbers less than

N = 10 are total = 1 + 3 + 5 + 7 + 9

So, the output should be

25.

Sample Input 1

10

Sample Output 1

25

Sample Input 2

5

Sample Output 2

9




Sum of Even numbers

Write a program to find the sum of even numbers in first N natural numbers.

Input

The input is an integer N.

Output

The output should be an integer containing the sum of even numbers upto the given number.

Explanation

In the given example

N = 5, the even natural numbers below 5 are 2, 4 Then total = 2 + 4

So, the output should be

6.

Sample Input 1

5

Sample Output 1

6

Sample Input 2

4

Sample Output 2

6




LATEST TUTORIALS
APPROVED BY CLIENTS