Python Answers

Questions answered by 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

Respond to the following question in at least three well composed paragraphs: What are the necessary conditions for a monopoly position in the market to be established?


Section 6.9 of your textbook ("Debugging") lists three possibilities to consider if a function is not working.

  • Describe each possibility in your own words.
  • Define "precondition" and "postcondition" as part of your description.
  • Create your own example of each possibility in Python code. List the code for each example, along with sample output from trying to run it.
  1. Does the submission include the is_divisible function from Section 6.4 of the textbook?
  2. Does the submission implement an is_power function that takes two arguments?
  3. Does the is_power function call is_divisible?
  4. Does the is_power function call itself recursively?
  5. Does the is_power function include code for the base case of the two arguments being equal?
  6. Does the is_power function include code for the base case of the two arguments being equal?
  7. Does the is_power function include code for the base case of the second argument being "1"?
  8. Does the submission include correct output for the five test cases?

1.  Flip the number: Write a program that prompts the user to enter a three digits positive integer. The program flips and prints the integer. For example, if the user enters 582 then the program prints 285.


simple output:

  1. Enter a 3-digits positive integer: 371 The flipped value of 371 is 173.
  2. Enter a 3-digits positive integer: 690 The flipped value of 690 is 96.

Armstrong numbers between two intervals

Write a program to print all the Armstrong numbers in the given range

A to B(including A and B). An N-digit number is an Armstrong number if the number equals the sum of the Nth power of its digits.Input

The first line has an integer

A. The second line has an integer B.Output

Print all Armstrong numbers separated by a space.

If there are no Armstrong numbers in the given range, print

-1.Explanation

For

A = 150 and B = 200For example, if we take number 153, the sum of the cube of digits

1, 5, 3 is 13 + 53 + 33 = 153.

So, the output should be

153.

Sample Input 1

150

200

Sample Output 1

153

Sample Input 2

1

3

Sample Output 2

1 2 3





Remove Vowels in a Sentence

You are given a sentence. Write a program to remove all the vowels in the given sentence. 

Note: Sentence has both lowercase and uppercase letters.

Input

The first line of input is a string 

N.

Explanation

In the example given a sentence 

Hello World, the sentence contains vowels e, o.

So, the output should be 

Hll Wrld.

Sample Input 1
Hello World
Sample Output 1
Hll Wrld
Sample Input 2
Once upon a time
Sample Output 2
nc pn  tm
Python 3.9
RESET
SAVE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
string = input()
if string == 'x':
    exit();
else:
    newstr = string;
   
    vowels = ('a', 'e', 'i', 'o', 'u');
    for x in string.lower():
        if x in vowels:
            newstr = newstr.replace(x,"");
    
    print(newstr);
     
     
         
                
        
Custom Input
RUN CODE
SUBMIT
TEST CASE 1
TEST CASE 2
Input
1
Once upon a time
Diff
Your Output
Onc pn  tm

Expected
nc pn  tm




Given X="ABCDEFGHIJKLMNOPQRSTUVWXYZ", X[8:16:2] is?



a) IKMO


b) IKMOQ


c) HJLNP


d) Error


Rearrange numbers in the string

example

hi im 98 and -12 also

output= hi im -12 and 98 also


Given day number D as input, write a program to display the day name


Write a program to find the hypotenuse H of a right-angled triangle of sides A and B.

output : 13

5

it should be : 5

output : 12

5

it should be 13.


LATEST TUTORIALS
APPROVED BY CLIENTS