Write a Python program that accepts a string and calculate thenumber of digits and letters
Sample Data : Python 3.9
Expected Output :
Letters 6
Digits 2
Write a Python program to convert temperatures to and from celsius, fahrenheit.
[ Formula : c/5 = f-32/9 [ where c = temperature in celsius and f = temperature in fahrenheit ]
Expected
Output :
60°C is 140 in Fahrenheit
45°F is 7 in Celsius
Input:1good23morning456
Output: goodmorning 123456
Explanation:given a string, write a program to remove all the numbers in it to its end.
Input: Tea is good for you
3
Output:is good
Explanation: given a string write a program to remove all the words with k length.
Get the input from the user for the number of rows and columns.
Print 0 in the row one.
Print 1 in the row two.
Case= Test 1
input=
5
5
output=
00000
11111
00000
11111
00000
Consider the Farmer-Wolf-Goat-Cabbage Problem described below:
Farmer-Wolf-Goat-Cabbage Problem
There is a farmer with a wolf, a goat and a cabbage. The farmer has to cross a river with all three things. A small boat is available to cross the river, but farmer can carry only one thing with him at a time on the boat. In the absence of farmer, the goat will eat the cabbage and wolf will eat the goat. How can the farmer cross the river with all 3 things?
Initial state: (L, L, L, L)
Operators:
1. Move farmer and wolf to the opposite side of river if goat and cabbage are not left alone.
2. Move farmer and goat to the opposite side of river.
3. Move farmer and cabbage to the opposite side of river if wolf and goat are not left alone.
4. Move farmer alone to the opposite side of river if wolf and goat or goat and cabbage are not left alone.
Goal state: (R, R, R, R)
Write a Python program that uses breadth-first search algorithm to solve the above problem.
Print the following pattern
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
write a program to print half of the numbers
Write a Python program to convert temperatures to and from celsius, fahrenheit.
[ Formula : c/5 = f-32/9 [ where c = temperature in celsius and f = temperature in fahrenheit ]
Expected Output :
60°C is 140 in Fahrenheit
45°F is 7 in Celsius
Write a Python program to convert temperatures to and from celsius,