Question

Write a program called life.py to generate all the three-letter words made from the letters “A”,...

Write a program called life.py to generate all the three-letter words made from the letters “A”, “B”, “C” and “D”. At least one function must be defined to solve the problem. The output shall be in the form of a table as shown below:

1 AAA

2 AAB

3 AAC

4 AAD

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def main():
    count = 1
    for c1 in "ABCD":
        for c2 in "ABCD":
            for c3 in "ABCD":
                print(count, c1 + c2 + c3)
                count += 1


main()

Add a comment
Know the answer?
Add Answer to:
Write a program called life.py to generate all the three-letter words made from the letters “A”,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • General Requirements . . . Write a program that reads letters from a file called "letters.txt"....

    General Requirements . . . Write a program that reads letters from a file called "letters.txt". Your program will open the letters.txt file read in one character at a time For this assignment the test file will contain at least 30 letters, uppercase OR lowercase In your program you will change each letter (solution) to uppercase Use the function toupper in #include <ctype.h> You create a numerical version of the uppercase letter from the file . o Use int numberSolution...

  • In a file called First SecondNext.java, write a program that: • Asks the user to enter...

    In a file called First SecondNext.java, write a program that: • Asks the user to enter a string that contains at least five letters. It is OK if your program crashes when the user enters a string with length less than 5. • Stores that string in a variable called s. • Creates a variable called "first", and sets it equal to the first letter of s. • Creates a variable called "second", and sets it equal to the second...

  • C Program In this assignment you'll write a program that encrypts the alphabetic letters in a...

    C Program In this assignment you'll write a program that encrypts the alphabetic letters in a file using the Vigenère cipher. Your program will take two command line parameters containing the names of the file storing the encryption key and the file to be encrypted. The program must generate output to the console (terminal) screen as specified below. Command Line Parameters Your program must compile and run from the command line. The program executable must be named “vigenere” (all lower...

  • Write a Java program that that capitalizes all first letters of the words in the given...

    Write a Java program that that capitalizes all first letters of the words in the given String. All other symbols should be intact. If a word does not start with a letter, it should remain intact as well. Assume that the parameter String can only contain spaces and alphanumeric characters. Example: Input: “100 234 jus 23 jskl” Output: “100 234 Jus23 jskl”

  • Matlab a) Write a MATLAB code that takes the grade letters from the user and provide him/her with the GPA for that seme...

    Matlab a) Write a MATLAB code that takes the grade letters from the user and provide him/her with the GPA for that semester Enter your grades (letters): AABBC (input) Your GPA is 3.2 output) b) Write a Matlab user defined function to that takes a letter grade and return a numeric grade as shown in the table below. Any other value should give an error message (Invalid Grade). You function name should be Letter2Grade Use the following information to calculate...

  • For this problem, you will write a program to form a frequency table of the letters...

    For this problem, you will write a program to form a frequency table of the letters in a text file, that is, how many times each letter appears in the file In Python 3.7. Such a frequency table might be useful for compressing a text file. Because different letters appear with different frequencies, we can compress a file by using shorter codes for common letters and longer codes for letters that appear less frequently. Dictionaries provide an elegant way to...

  • Using basic c++ write 2 separate codes for this assignment. Program #1 Write a program that...

    Using basic c++ write 2 separate codes for this assignment. Program #1 Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions. • void getScore() should ask the user for a test score, store it in the reference parameter variable, and validate it. This function should be called by the main once for each of the five scores to be entered. •...

  • Write a function called most_consonants(words) that takes a list of strings called words and returns the...

    Write a function called most_consonants(words) that takes a list of strings called words and returns the string in the list with the most consonants (i.e., the most letters that are not vowels). You may assume that the strings only contain lowercase letters. For example: >>> most_consonants(['python', 'is', 'such', 'fun']) result: 'python' >>> most_consonants(['oooooooh', 'i', 'see', 'now']) result: 'now' The function that you write must use a helper function (either the num_vowels function from lecture, or a similar function that you...

  • How many three-letter "words" can be made from 6 letters "FGHIJK" if repetition of letters (a)...

    How many three-letter "words" can be made from 6 letters "FGHIJK" if repetition of letters (a) is allowed? An access code consists of 1 letter of the alphabet followed by 6 digits. (Digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.) How many different access codes are possible? A jar contains 9 red marbles, numbered 1 to 9, and 12 blue marbles numbered 1 to 12. a) A marble is chosen at random. If you're told the...

  • Solve it in Python 4. An alternade is a word in which its letters, taken alternatively...

    Solve it in Python 4. An alternade is a word in which its letters, taken alternatively in a strict sequence, and used in the same order as the original word, make up at least two other words. All letters must be used, but the smaller words are not necessarily of the same length. For example, a word with seven letters where every second letter is used will produce a four-letter word and a three-letter word. Here are two examples: "board":...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT