Questions: 5 831

Answers by our Experts: 5 728

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 & Filtering

Write a program to print the following pattern using for loop:

? ? ? ? ? ?

? ? ? ? ?

? ? ? ?

? ? ?

? ?

?


Write a program to display all prime numbers within a range defined by the user as input


Take an even number between 10 and 50 from the user as input. Calculate the sum of all numbers from 1 till the input number. Make sure the necessary are checks are placed for while taking input.


Print the following pattern using for loops:

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5


1.Write an Employee class that keeps data attributes for the following pieces of information:

a. Employee name

b. Employee number Next, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information:

c. Shift number (an integer, such as1 for morning shift, 2 for evening shift)

d. Hourly pay rate Write the appropriate accessor and mutator methods for each class



1.Write an Employee class that keeps data attributes for the following pieces of information:

a. Employee name

b. Employee number Next, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information:

c. Shift number (an integer, such as1 for morning shift, 2 for evening shift)

d. Hourly pay rate Write the appropriate accessor and mutator methods for each class



Given a string, write a program to print a secret message that replaces characters with numbers 'a' with 1, 'b' with 2, ..., 'z' with 26 where characters are separated by '-'.


Note: You need to replace both uppercase and lowercase characters. You can ignore replacing all characters that are not letters.


a b c d e f g h i j k l m n o p q r s t u v w x y z

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26


Input

Explanation


For example, if the given input is "python", "p" should replaced with "16", similarly"y" with "25","t" with "20","h" with "8","o" with "15","n" with "14". So the output should be "16-25-20-8-15-14".

  • Sample Input 1
python learning
  • Sample output:
16-25-20-8-15-14 12-5-1-18-14-9-14-7

Max continues matrix


CONTINUATION 2

  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 

Print each string in the list and whether or not it has any duplicates based on the return value of has_duplicates for that string. For example, the output for "aaa" and "abc" would be the following. 

aaa has duplicates

abc has no duplicates

Print a line like one of the above for each of the strings in test_dups. 


CONTINUATION......

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 

  Implement has_duplicates by creating a histogram using the histogram function above. Instead, your implementation should use the counts in the histogram to decide if there are any duplicates. 

Write a loop over the strings in the provided test_dups list.


LATEST TUTORIALS
APPROVED BY CLIENTS