Next, describe at least three additional Python experiments that you tried while learning Chapter 1. Show the Python inputs and their outputs, and explain what you learned from the results of each example. v
Compare the two strings is equal or not....
The "*" and "?" Can treated as a replace for characters
?=is used as replace for 1 character
* = It can be as replace for 1 to length of the character and can also used as a empty string
1st question:
3
Maggi Ma*i
Maggi Ma?gi
Maggi M*?
Answer:
True
True
True
2nd question:
Tree tr*
Plant Pl**
Dance D*ance
Answer:
False
True
True
Write a programe to check the overlapping of one string's suffix with the prefix of another string
If you are trying to print a string, what happens if you leave out one of the quotation marks or both and why?
Search Game
A grid of letters may contain a word hidden somewhere within it. The letters of the word may be traced from the starting letter by moving a single letter at a time, up, down, left or right. For example, suppose we are looking for the word BISCUIT in this grid:
2
B
T
1
U
A
C
2
S
V
D
N
The word starts in the top left corner, continues downwards for 2 more letters, then the letter to the right followed by 2 letters moving upwards, the final letter at the right of the penultimate one.
Write a program in which we give target word and a grid of letters as input returns a list of tuples, each tuple being the row and column of the corresponding letter in the grid (numbered from 0). If the word cannot be found, output the string Not present
you need to make a train ticket booking system
where you need to have the data enter by user about trains and search by trainname
Sum of prime numbers in the input
def mystery1(x):
return x + 2
def mystery2(a, b = 7):
return a + b
#MAIN
n = int(input("Enter a number:"))
ans = mystery1(n) * 2 + mystery2 (n * 3)
print(ans)
What is output when the user enters -4?
Tournament Training:
To prepare for the upcoming marthon.Ramesh trains one long distancerun each saturday .He considers a saturday to be a progress day if he runs more kilometers thsn the previous saturday Ramesh wants to track the no.of progress day
Given the no.of kilometer run by rsmesh on each aturday print the total no.of progress days
The 1st line of input contains space-seperated integers
i/p:
12 11 10 12 11 13
o/p:2
i/p:1 2 1 1 1
o/p:1
Number of moves:
you are given a nxn square chessboard with one bishop and k number of obstacles placed on it. A bishop can go to different places in a single move. find the total no.of places that are possible for the bishop in a single move. Each square is referenced by a type describing the row, R, and column, C, where the square is located.
explanation: given N=6 K=2
bishop position 5 2
obstacle positions (2 2), (1 5)
the bishop can move in so o/p is 6
I/p:
6 2
5 2
2 2
1 6
O/p:
6
I/p:
6 4
3 3
1 3
3 1
5 1
1 5
O/p: 7