anil is given a sentence as he tries to make a sentence special a sentence can be made special by swapping the character with high frequency with the character having low frequency in the sentence help anil by transforming the sentence into. a special sentence in python.
swap most frequent letter with least given a sentence, swap the occurrences of the most frequenti with the least frequent letter and vice-versa. submisdong note: • consider upper and lower case letters as different . if there are multiple letters with the same frequency, choose the lower case letter that comes earliest in dictionary order o if letters like x and b have same frequency consider x o if letters like x and b have same frequency consider b.
Input: Python is a programming language
Output should be: Python is e progremming lenguega
Most frequentl digit in python
Hollow Right Triangle - 2
Given an integer number N as input. Write a program to print the hollow right-angled triangular pattern of N lines as shown below. Note: There is a space after each asterisk ( ) character.
Input
The first line of input is an integer N
Explanation
In the given example the hollow right angled triangle of side 5
Therefore, the output should be
*
* *
* *
* *
* * * * *
Write a program to print the LARGEST ODD fibonaci number in a given range. If the number doesn't fall in the given range then print 0.
Example 1:
Given input
100
250
Expected output
233
Example 2:
Given input
4000
11000
Expected output
6765
input1, input2, input3 and input4 are the four given input numbers.
The function is expected to find and return the most frequent digit.
Example1 –
If input1=123, input2=234, input3=345, input4=673
We see that across these four numbers,
1, 5, 6 and 7 occur once,
2 and 4 occur twice, and
3 occurs four times.
Therefore, 3 is the most frequent digit and so the function must return 3
NOTE: If more than a digit occurs the same number of most times, then the highest of those digits should be the result. Below example illustrates this.
Example2 –
If input1=123, input2=456, input3=345, input4=5043
We see that
0, 1, 2 and 6 occur once, and
3, 4 and 5 occur thrice.
As there are three digits (3, 4 and 5) that occur most number of times, the result will be the highest (max) digit out of these three. Hence, the result should be 5
Let us see couple of more examples
Write a program to print the LARGEST ODD fibonaci number in a given range. If the number doesn't fall in the given range then print 0.
Example 1:
Given input
100
250
Expected output
233
Example 2:
Given input
4000
11000
Expected output
6765
develop a real time currency converter with GUI using python
Write a program that take an infix expression from user. The expression may contain parenthesis and these operators +-*/^
You have to apply the following tasks onto that expression
(a) Convert that expression from infix to postfix using Stack
(b) The converted expression should be evaluated using Stack
Start with the following Python code.
alphabet = "abcdefghijklmnopqrstuvwxyz"
test_dups = ["zzz","dog","bookkeeper","subdermatoglyphic","subdermatoglyphics"]
test_miss = ["zzz","subdermatoglyphic","the quick brown fox jumps over the lazy dog"]
def histogram(s):
d = dict()
for c in s:
if c not in d:
d[c] = 1
else:
d[c] += 1
return d
The function has_duplicates should take a string parameter and return True if the string has repeated characters. Otherwise, it should return False.
Use has_duplicates by creating a histogram using the histogram function above.
Write a loop over the strings in test_dups list.
write a function missing_letters that takes a string parameter and returns a new string with all the letters of the alphabet that aren't in the argument string. The letters in the returned string should be in alphabetical order
Given a string, write a program to move all the numbers in it to its start.