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 decide to buy some stocks for a certain price and then sell them at another

price. Write a program that determines whether or not the transaction was

profitable.

• Take 3 separate inputs: the # of shares, the purchase

price of the stocks, and the sale price, in that order.

• You purchase the # of stocks determined by the input.

• When you purchase the stocks, you pay the price determined by the input.

• You pay your stockbroker a commission of 3% on the amount paid for

the stocks.

• Later, you sell the all of the stocks for the price determined by the input.

• You pay your stockbroker another commission of 3% on the amount

you received for the stock.


Your program should calculate your net gain or loss during this transaction and

print it in the following format:


If your transaction was profitable (or if there was a net gain/loss of 0) print:

"After the transaction, you made 300 dollars."


If your transaction was not profitable, print:

"After the transaction, you lost 300 dollars."



Machine Problem 1



Number Guessing Game



In the number guessing game, the computer will randomly select a number from a range of numbers e.g. 1-100 and then the game will give the player five attempts to guess the number.



Gameplay:



• If the player's guess is higher than the chosen number, the program will tell the player to try another LOWER than the previous guess.



• If the player's guess is lower than the chosen number, the program will tell the player to try another number HIGHER than the previous guess.



■ If the player guesses the number before he consumes the five attempts, then display congratulatory message.

Machine problem 3



In the game Rock Paper Scissors, two players simultaneously choose one of the three options: rock, paper, scissors. If both player choose the same option, then the result is a tie. However, if they choose differently, the winner is determined as follows:



• Rock beats scissors, because a rock can break a pair of scissors



• Scissors beats paper, because scissors can cut paper



• Paper beats rock, because a piece of paper can cover a rock



Create a Python script in which a computer randomly choose rock, paper or scissors. Let the user enter a number 1, 2, or 3 each representing one of the three choices. Then, determine the winner.

why using num variable please explain


Given a string, create a new string with all the consecutive duplicates removed.




Hint: You may make a new string to store the result. You can check whether the current character and the next character are the same, then add that character to the new string.




Note: Only consecutive letters are removed not all duplicate occurences of a letter. You may try doing this alternative i.e. removing all duplicate letters from a given string, for your own practice.




Sample Input 1:



AAABBBBCDDBBECE




Sample Output 1:


ABCDBECE




Sample Input 2:



Jupyter Notebook is better. Case sensitivity check AAaaaAaaAAAa.




Sample Output 2:



Jupyter Notebok is beter. Case sensitivity check AaAaAa.

Write a python program that splits a given string on a given split character. The first input is a String and the second input is the character that will be used to split the first String.



[You cannot use the built-in split function for this task]



=====================================================================



Sample Input 1:


This-is-CSE110


-



Sample Output 1:


This


is


CSE110



Explanation: The second input which is the character '-', is used to split or divide the first input String 'This-is-CSE110' into 'This', 'is' and 'CSE110' which are printed individually in separate lines.



=====================================================================



Sample Input 2:


tom@gmail,harry@yahoo,bob@gmail,mary@gmail



,



Sample Output 2:



tom@gmail



harry@yahoo



bob@gmail



mary@gmail

Difficult Addition


Arjun is trying to add two numbers. Since he has learned addition recently, an addition which requires a carry is difficult for him. Your task is to print Easy if the addition does not involve a carry, Otherwise print Hard.


Input

The first line of input contains two space separated integers A and B.


Output

If the addition does not involve a carry,print Easy, otherwise print Hard.


Explanation

When calculating 229 + 390, we have a carry from the tens digit to the hundreds digit, so the answer is Hard.


Sample Input1

123456789 9876543218

Sample Output1

Easy


Sample Input2

229 390

Sample Output2

Hard




question: Cards Game


There are M people from 1 to M . Andy has N cards with her. Starting with person Z , he gives the cards one by one to the people in the numbering order. Z, Z+1, Z+2,.....,M, 1, 2,....Z-1. Your task is to output the number of the person who will get the last card.


input 1:- 3 3 2

output 1:- 1

input 2 :- 1 100 1

output 2:- 1


question: Difficult Addition


Arjun is trying to add two numbers. since he has learned addition recently, an addition which requires carry is difficult for him . your task is to print "Easy" if the addition doesn't

involve carry, otherwise print "Hard"


Input 1 :- 229 390

output 1 :- Hard

Input 2 :- 123456789 9876543210

output 2 :- Easy




Question 3

Rules:

1. Play a simple Black Jack game.

2. The player will get two cards first.

3. If the player get black Jack (21 points or two Aces), the player won and does not need to draw the third card.

4. If not, ask if the player wanted to draw the third card.

5. If the player get points less than 22, he won, else he lost.


Points:

1. J, Q and K is 10 points.

2. A is 11 points, but it will become 1 point if the player chooses to draw the third card.

3. Add up the points from the cards and show the final result.


LATEST TUTORIALS
APPROVED BY CLIENTS