I suppose change the background picture/colour ?
Answer:
/*
* Program to print traingle using asterisk.
*/
#include<iostream>
using namespace std;
//Function to print n asterisk in a row.
void printAsterisk(int n)
{
for(int i = 0;i<n;i++)
cout<<"*";
}
int main()
{
//Variable to store size of trianle
int size;
cout<<"Enter the size of triangle"<<endl;
cin>>size;
//print asterik in increasing order line by line.
for(int i =0; i<size;i++)
{
printAsterisk(i);
cout<<endl;
}
//print asterik in decresing order line by line.
for(int i =size-1; i>0;i--)
{
printAsterisk(i-1);
cout<<endl;
}
}
Output:
Enter the size of triangle
10
*
**
***
****
*****
******
*******
********
*********
********
*******
******
*****
****
***
**
*
Explanation:
Since no programming language is mentioned therefore answer is provided in C++.
The above program will use two for loops to print the triangle using asterisk.
The first loop will print the asterisk line by line with each line having one more asterisk than the previous one till the size of the triangle.
The second for loop will print the asterisk using same logic as above but in reverse order.
Final output of triangle will be obtained.
Answer:
#section 1
import re
thesaurus = {
"happy" : "glad",
"sad" : "bleak",
}
text =input('Enter text: ').lower()
#section 2
def synomReplace(thesaurus, text):
<em> # Create a regular expression from the dictionary keys
</em>
regex = re.compile("(%s)" % "|".join(map(re.escape, thesaurus.keys())))
# For each match, look-up corresponding value in dictionary
return regex.sub(lambda x: thesaurus[x.string[x.start():x.end()]].upper(), text)
print(synomReplace(thesaurus, text))
Explanation:
#section 1
In this section, the regular expression module is imported to carry out special string operations. The thesaurus is initialized as a dictionary. The program then prompts the user to enter a text.
#section 2
In the section, we create a regular expression that will search for all the keys and another one that will substitute the keys with their value and also convert the values to uppercase using the .upper() method.
I have attached a picture for you to see the result of the code.
Yes it is a way. hope this helps
<span>Consider
the cement used for the foundation; the bricks and timber used for the
walls; and the shingles used for the roof. All of these are __________
in making the house.
A. Elements</span>