Questions: 5 290

Answers by our Experts: 5 288

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

You are required to design and implement a “Dice Roller” program that allows the user to simulate rolling dice. The user is prompted to enter their desired roll in “[quantity]d[sides]” format, e.g. “4d6” would roll four six-sided dice and “2d10” would roll two ten-sided dice. After each roll, some statistics are displayed and the user is prompted to enter another roll. The user may enter “x” to exit the program, or “h” to view some instructions. An advanced feature of the program is to allow the user to perform rolls with “exploding dice”, indicated by adding a “!” to the end of the roll, e.g. “4d6!” This is detailed later in this document. Details of the program requirements can be found in the “Program Requirements” section.


Convert a ten digit number to a string following the rules

Andy has the word W and he wants to print the unique characters in the word in the order of their occurrence.write a program to help Andy print the unique characters as described above.


NOTE : consider lower and upper case letters as different


Input

The input is a single line containing the word W.


Output

The output should be a single line containing space separated characters.


Explanation

In the example, the word is MATHEMATICS

The unique characters in the given word are M, A, T, H, E, I, C, S, in the order of occurrence.so the output should be M A T H E I C S.


Sample Input1

MATHEMATICS

Sample Output1

M A T H E I C S


Sample Input2

banana

Sample Output2

b a n


Write a program to print a parallelogram pattern with * characters. The size N represents the length (the number of * characters in each line)& breadth ( the number of lines) of the parallelogram.

The slope of the parallelogram T represents the number of extra spaces a line should have in the beginning compared to its next line. The last line of the pattern does not have any spaces in the beginning.


Explanation:

Given N=3 and T=2

Each line should have 3 star(*) characters.

The last line should have 0 spaces at the beginning.

Each line has 2 extra spaces characters when compared to its next line.


Sample Input1

2

2

Sample Output1

  **
**


Sample Input2

3

2

Sample Output2

    ***
  ***
***

Write a program to print a parallelogram pattern with * characters. The size N represents the length (the number of * characters in each line)& breadth ( the number of lines) of the parallelogram.

The slope of the parallelogram T represents the number of extra spaces a line should have in the beginning compared to its next line. The last line of the pattern does not have any spaces in the beginning.


Explanation:

Given N=3 and T=2, each line should have 3 star(*) characters.

The last line should have 0 spaces at the beginning.

Each line has 2 extra spaces characters when compared to its next line.


Sample Input1

2

2

Sample Output1

 **
**

Sample Input2

3

2

Sample Output2

  ***
 ***
***

Write a python script that checks if integer numbers between 1 and an integer input from a user are prime numbers (Hint: use the range function to loop between 0 and an integer input).

In a case where prime numbers are identified then add all prime numbers to a new list and display the list, in case where a number is not a prime number display an error message.


1. Write a program that asks the user for a height in inches and prints out how many feet and inches that is. There are 12 inches in one foot. For instance, 40 inches is 3 feet and 4 inches. [Hint: use the // operator and the % operator to get each part.]   


You're decorating a room with balloons for your friend's birthday party. There are balloons of K different colors, and you have access to infinite amount of balloons of any color. You want to arrange N balloons in a row, with the only condition that no two adjacent balloons can be of the same color, because your friend will dislike it.


How many ways are there to arrange the balloons?

Since the answer can be very large, print it modulo 10^9+7.


Yasoda went to a store to buy Ingredients to make a boul of soup.While billing the order,salesperson found that some ingredients are stale.So, he wants to separate the stale ingredients from the rest.You are given the prices of the ingredients,where a negative price value indicates a stale ingredient.Write a program to help the sales person to move the prices of all the stale ingredients to left without changing the relative order of the ingredients.


Input

The first line of input contains space-separated integers.


Explanation

In the example, there are 6 ingredients with prices 11,-12,13,-14,15,16 respectively.

The prices of the stale ingredients in the given list are -12 and -14 in the order of occurence.

So, the output is -12 -14 11 13 15 16.


Sample Input1

11 -12 13 -14 15 16

Sample Output1

-12 -14 11 13 15 16


Sample Input2

21 11 -3 -2 9

Sample Output2

-3 -2 21 11 9



Max Profit

You given a list of prices where prices[i] is the price of a given stock o the i th day write a program to print the maximum profit by choosing a single day to buy a stock and choosing a different day in the future to sell that stock if these is no profit that can be achieved return 0.


Input

The input is a single line containing space seperated integers.


Output

The output should be a single line integer.


Explanation

In the example the given prices are 7 1 5 3 6 4.

buying stocks on day two having price 1 and selling them on the fifth day having price 6 would give the maximum profit which is 6 - 1

so the output should be 5.


Sample Input1

1 2 1 3 6 7 4

Sample Output1

6


LATEST TUTORIALS
APPROVED BY CLIENTS