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

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

write an expression that evaluates to true if and only if the string variable s equals the string "end".


Write a python program that takes 2 inputs from the user. The first input is a string and the second input is a letter. The program should remove all occurences of the letter from the given string and print the output. If the letter is not found in the string and the length of string is greater than 3, then remove the first letter and last letter of the given string and print it. Otherwise print the string as it is. You can assume that all the input will be in lowercase letter.


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.


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]


Write a Python program that takes a String as input from the user, removes the characters at even index and prints the resulting String in uppercase without using the built-in function upper().


Write a Python program that takes a string as an input from the user containing all small letters and then prints the next alphabet in sequence for each alphabet in the input.

Hint: You may need to use the functions ord() and chr(). The ASCII value of ‘a’ is 97 and ‘z’ is 122.

Write a Python program that will ask the user to input a string (containing exactly one word). Then your program should print subsequent substrings of the given string as shown in the examples below.

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

Hints(1): You may use "for loop" for this task.

Hints(2): You may use print() function for printing newlines.

For example:

print(1)

print(2)

Output:

1

2

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

We can use print(end = "") to skip printing the additional newline.

For example:

print(1, end ="")

print(2)

Output:(prints the following output right next to the previous one)

12

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

Sample Input 1:

BANGLA

Sample Output 1:

B

BA

BAN

BANG

BANGL

BANGLA

.

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

Sample Input 2:

DREAM

Sample Output 2:

D

DR

DRE

DREA

DREAM


Write a Python program that will ask the user to enter a word as an input.

  • If the length of the input string is less than 4, then your program should print the same string as an output.
  • If the input string’s length is greater than 3, then your program should add "er" at the end of the input string.
  • If the input string already ends with "er", then add "est" instead, regardless of the length of the input string
  • If the input string already ends with "est", then your program should print the same input string as an output.

Machine problem 2


Create a Python script that will generate random n integers from a given start and end of a range.


Sample Output:


Value for n:5


Value for start: 1


Value for end : 10


10 8 7 8 3

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS