Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
850 B
4
Indexable
Never
# lab 1
def sqr_n(n):
    for number in range(1,n):
        print(f"{number} x {number} = {number*number}") 


n = int(input("Enter the value of n : "))

# lab 2
sqr_n(n)
def pattern ():
    for i in range(3):
        for j in range (3):
            print("x",end="")
            for k in range (4):
                if(j == 2):
                    break
                print("-",end="")
        print("\n")
        
        if (i == 2):
            break
        for l in range (4):
            for j in range (3):
                print("|",end="")
                for k in range (4):
                    print(" ",end="")
            print("\n")

pattern()




# lab 3
def infinite_sum():
    sum = 0 
    while(1):
        temp=int(input("Enter the number to be added : "))
        sum+=temp
        print(f"Current sum is {sum}")

infinite_sum()
Leave a Comment