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
def main(): count = 1 for c1 in "ABCD": for c2 in "ABCD": for c3 in "ABCD": print(count, c1 + c2 + c3) count += 1 main()
Write a program called life.py to generate all the three-letter words made from the letters “A”,...
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 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 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 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 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 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 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 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) 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...
IN PYTHON Write a program that, given a set of words in a list, calculate how many words begin with the letter you capture. Entry: 5 words and 1 letter Output: # of words that have the letter. IMPORTANT NOTE: Your program should not include an input message: you are only going to capture the 5 words and finally the letter you want to find and as an output message you must indicate only the number of words that begin...