Question

5 nt code ven in this question draw small squares and lines exceperian You have to write

Using PYTHON

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hey here is my code in c++ as i am more proficient in that. If you are familier with python then it is easy for you to just see the for loops and implement it in python

#include <iostream>
using namespace std;
int main()
{
int n=7;
int i,j;
int sp=0;
for(int i=0;i<=n-1;++i)
{
for (j=1;j<=sp;j++) cout<<" ";
sp++;
for (j=1;j<=2*(n-i);j++) cout<<"*";
cout<<endl;
}
sp--;
for (j=1;j<=sp;j++) cout<<" ";
cout<<"*"<<endl;
for (j=1;j<=sp;j++) cout<<" ";
  
cout<<"*"<<endl;
sp=n-1;
for(int i=1;i<=n;++i)
{
for (j=1;j<=sp; j++) cout<<" ";
sp--;
for (j=1;j<=2*i;j++) cout<<"*";
cout<<endl;
}
return 0;
}

Add a comment
Know the answer?
Add Answer to:
Using PYTHON 5 nt code ven in this question draw small squares and lines exceperian You...
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
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
Active Questions
ADVERTISEMENT