View the step-by-step solution to:

def pascal(n): """Prints n first lines of Pascal`s triangle author: DR#m <dnpsite.narod.ru> last rev 20.05"""...

another tutor did question 1 for me but it is not a triangle, would you mind checking it and fixing it?

thank you

def pascal(n): """Prints n first lines of Pascal`s triangle author: DR#m <dnpsite.narod.ru> last rev 20.03.05""" l=[1] p=[] for i in range(n): l2=[1] for j in range(len(l)-1): l2.append(l[j]+l[j+1]) l2.append(1) print(l) l=l2 def myfunction(): input1 = input("Input the number you want to use in the pascal Triangle: .") return int(input1) if __name__=="__main__": pascal(myfunction())
Background image of page 1
Sign up to view the entire interaction

Top Answer

Here is the explanation for... View the full answer

a5q1.py

def factorial(n):
r = 1
if n &gt; 0:
for i in range(1, n + 1):
r = r * i
return r
def combination(n, k):
nCk = factorial(n)/(factorial(n-k) * factorial(k))
return int(nCk)
def pascalTriangle(n):...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online