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

Given a string, write a program to mirror the characters of the string in alphabetical order to create a secret message.

Note: Mirroring the characters in alphabetical order replacing the letters 'a' with 'z', 'b' with 'y', ... , 'z' with 'a'. You need to mirror both uppercase and lowercase characters. You can ignore mirroring for all characters that are not letters.

abcdefghijklmzyxwvutsrqpon nopqrstuvwxyzmlkjihgfedcbaInput

The input will be a string in the single line containing spaces and letters (both uppercase and lowercase).Output

The output should be a single line containing the secret message. All characters in the output should be in lower case.

Explanation

Sample Input 1

python

Sample Output 1

kbgslm

Sample Input 2

Foundations

Sample Output 2

ulfmwzgrlmh




Day Name - 2

Given the weekday of the first day of the month, determine the day of the week of the given date in that month.

Input

The first line is a string

D. The second line is an integer N.Output

The output should be a string.

Explanation

In the given example,

D = Monday. As the 1st of the day of the month is a Monday, it means the 7th and 14th of the month will also be Mondays (A week has 7 days). So the 16th day (N = 16) of the month will be a Tuesday.So, the output should be

Tuesday.

Sample Input 1

Monday

16


Output:

Tuesday


sample Input-2:

Tuesday

17


Output:

Thursday


integers = [int(number) for number in input().split()]

K = int(input())

triplets = []

for i in range(len(integers)):

for j in range(i+1,len(integers)):

for k in range(j+1, len(integers)):

tmp = tuple(sorted([integers[i], integers[j], integers[k]]))

if sum(tmp) == K:

if tmp not in triplets:

triplets.append(tmp)

triplets_tuple = tuple(sorted(triplets))

print(*triplets_tuple, sep='\n')

It should also print if there is no triplets matching it should print

Input:

1 5 6 3 5 11

30

Output:

No Matching Triplets Found




  • For this discussion board you are asked to  
  • Consider what you've learned about Python and Visual Basic
  • Read (or re-read) the readings from this module regarding the high-level languages C++, Java, and C#, and their strengths and weaknesses.  
  • Find at least one online reference source on a different programming language that you can discuss and cite. Pick something that interests you. Examples include JavaScript, PHP, SQL, Haskell, Ruby, and numerous others, some more specialized than others.
  • Based on all that information make an original posting either comparing two or more of the languages, or describing one of them (strengths and weaknesses) in some detail. We're primarily concerned with basic structure/syntax and how they work as procedural and/or object oriented programming languages -- not fine details. Make sure you include citation(s) to the new source(s) of information that you've found. 

Max Contiguous Subarray

Given a list of integers, write a program to identify the contiguous sub-list that has the largest sum and print the sum. Any non-empty slice of the list with step size 1 can be considered as a contiguous sub-list.Input


The input will contain space-separated integers, denoting the elements of the list.Output


The output should be an integer.Explanation


For example, if the given list is [2, -4, 5, -1, 2, -3], then all the possible contiguous sub-lists will be,

[2]
[2, -4]
[2, -4, 5]
[2, -4, 5, -1]
[2, -4, 5, -1, 2]
[2, -4, 5, -1, 2, -3]
[-4]
[-4, 5]
[-4, 5, -1]
[-4, 5, -1, 2]
[-4, 5, -1, 2, -3]
[5]
[5, -1]
[5, -1, 2]
[5, -1, 2, -3]
[-1]
[-1, 2]
[-1, 2, -3]
[2]
[2, -3]
[-3]

Among the above contiguous sub-lists, the contiguous sub-list [5, -1, 2] has the largest sum which is 6.

Sample Input 1

2 -4 5 -1 2 -3

Sample Output 1

6

Sample Input 2

-2 -3 4 -1 -2 1 5 -3

Sample Output 2

7




 code in  Question #175894  gives result:12x^4 + 9x^3 + -5x^2 - 1x - 1 but 12x^4 + 9x^3 - 5x^2 - x - 1 is desired output.
how to get desired result .
input = 
5
0 -2
3 6
4 7
1 -3
2 -1
5
0 1
1 2
2 -4
3 3
4 5


 Question #175894 




M, N = input().split()

M, N = int(M), int(N)

matrix = []

for _ in range(M):

row = [int(x) for x in input().split(' ')]

matrix.append(row)

K = int(input())

values = matrix[0][:-1] + [x[-1] for x in matrix][:-1] + matrix[-1][::-1][:-1] + [x[0] for x in matrix][::-1][:-1]

values = values[-K:] + values[:-K]

output = matrix

idxs = [(0, j) for j in range(N)][:-1] + [(i, N - 1) for i in range(M)][:-1] + [(M - 1, j) for j in range(N)][::-1][:-1] + [(i, 0) for i in range(M)][::-1][:-1]

idx = 0

for i, j in idxs:

output[i][j] = values[idx]

idx += 1

print(output)

input:4 4

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16

3

output should be like this:

13 9 5 1

14 7 11 2

15 6 10 3

16 12 8 4 can you please make code


integers = [int(number) for number in input().split()]

K = int(input())

triplets = []

for i in range(len(integers)):

  for j in range(i+1,len(integers)):

    for k in range(j+1, len(integers)):

      a = integers[i]

      b = integers[j]

      c = integers[k]

      if a+b+c == K:

        triplets.append(tuple((a,b,c)))

sorted_triplets=[]

for tripl in triplets:

  item = sorted(tripl)

  sorted_triplets.append(item)

triplets= sorted(sorted_triplets)

if len(triplets)!=0:

  for triplet in triplets:

    triplet=sorted(triplet)

    tuple_a=tuple(triplet)

    print(tuple_a)

input:0 1 2 3 5 7 13 17 19 19

22

output should be like this :

(0, 3, 19)

(0, 5, 17)

(1, 2, 19)

(2, 3, 17)

(2, 7, 13)


You are given three numbers. Check if any of the numbers exist in the range from 10 to 20 (including 10 and 20).




Many drugs, legal or not, work by either stimulating or inhibiting specific metabolic enzymes. As such, products of metabolic reactions can be selectively increased or decreased depending on the drug’s mechanism of action in the cell. In your readings, you learned that statins are a class of drugs used to reduce cholesterol levels. Their mechanism of action is to inhibit the enzyme HMG-CoA reductase. HMG-CoA reductase is the enzyme that synthesizes cholesterol from lipids in the body. By inhibiting this enzyme, the levels of cholesterol synthesized in the body can be reduced.

You will research and present a drug of your choosing for this assignment. You are free to chose any drug as long as it works by inhibiting a specific enzyme; e.g., statins. You cannot, however, use statins.


Write a 2-3 page (500 – 750 words, 12 point font) paper including the following elements. Be sure to compose your work with your own words. Do not copy and paste from any source.


LATEST TUTORIALS
APPROVED BY CLIENTS