0% found this document useful (0 votes)
10 views4 pages

Bca Python Prcactical File

The document contains a series of programming tasks with their respective coding solutions. Each task includes a description, coding implementation, and expected output. The tasks cover printing patterns, finding the largest number among three integers, reprinting user input until a specific string is entered, summing integers until a sentinel value is given, and printing the alphabet infinitely until a specific condition is met.

Uploaded by

sarthak1058
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

Bca Python Prcactical File

The document contains a series of programming tasks with their respective coding solutions. Each task includes a description, coding implementation, and expected output. The tasks cover printing patterns, finding the largest number among three integers, reprinting user input until a specific string is entered, summing integers until a sentinel value is given, and printing the alphabet infinitely until a specific condition is met.

Uploaded by

sarthak1058
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Que1.

) Write a program to print


*******
*** ***
** **
* *
Coding : -
print("*" *7)

j=1

for i in range(3,0,-1):

print("*" * i, end="")

print(" " * j, end="")

print("*" * i)

j=j+2

Output :-

Que2.) Write a program to find the largest of 3 integers .


Coding :-
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
num3 = float(input("Enter third number: "))
if (num1 >= num2) and (num1 >= num3):
largest = num1
elif (num2 >= num1) and (num2 >= num3):
largest = num2
else:
largest = num3
print("The largest number is", largest)
Output : -

Que 3.) Write a program to reprint the user string input until ‘XATI’ is given .
Coding :-
i=1
while i>0:
n=input("enter String")
if n=="XATI":
break;
else:
print(n)
Output :-

Que 4.) Write a program to add all the input integers & print if ‘s’ .
Coding :-
num = 0
tot = 0.0
while True:
number = input("Enter a number")
if number == 's':
break
try :
num1 = float(number)
except:
print('Invailed Input')
continue
num = num+1
tot = tot + num1
print (tot)
Output :-

Que 5.) Write a program to print the alphabet Infinitely "S" Is Given.
Coding :-
for i in range(1,26):
for j in range(65, 65+i):
a = chr(j)
print(a, end="")
print()
for i in range(26, 0, -1):
for j in range(65, 65+i):
a = chr(j)
print(a, end="")
print()
OUTPUT :-

You might also like