Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7579267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:38:07+00:00 2026-05-30T17:38:07+00:00

So I am creating a program to generate pascal’s triangle, which I know has

  • 0

So I am creating a program to generate pascal’s triangle, which I know has been done to death, however the way I am told to go about it is different then how I would have thought. I am just needing some help translating the beginning so that I can get it rolling. It basically states assign a list to be empty to represent the triangle and
for each row of the triangle from 0 to the height+1 assign a list to be empty to represent one new row of the triangle.If the new row is row zero make the new row to be a [1].

So what I have so far is

h=input("enter height")
mytri=[]
for i in range(0,h+1):
    row=[ ] 
    if i==0:
        newrow=[1]
    elif newrow==1:
    #here is where I get lost

Where I am having trouble is finding out how to tell if the new row is row zero or row 1. Have yet to see anything like that in my short experience with python. Any help is greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:38:08+00:00Added an answer on May 30, 2026 at 5:38 pm

    In your third line, you are running a for loop, so that will be a for there instead of an if.

    Coming to your question, you need to know the row number and check whether it is something, right? Look carefully, what variable in your code corresponds to the row number?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been tasked with creating a program that will generate an amortization schedule.
I am creating a program which has an installer-like interface. Is it better to
I creating a program which send newsletter with a background image. It works fine
I have been tasked with creating a program what will create take files in
I've been tasked (by my wife) with creating a program to allow her to
I'm creating a program to automatically generate reports from incoming email attachments and it
I'm creating a program which creates several panels with randomly determined colors which will
I'm creating a program that communicates with a webservice, which is written with JSP
I'm writing a program which aims to generate a lot of activity in Active
I am creating a program that will be installed using the .net installer project.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.