0% found this document useful (0 votes)
4 views10 pages

Python Basics: Functions & Patterns

The document contains a lab assignment by Srushti Vijay Uttarkar for FY BCA Division-B, focusing on programming tasks related to data types, flow control, and functions in Python. It includes programs for checking prime numbers, determining Armstrong numbers, calculating BMI, and printing various patterns, as well as a temperature conversion from Celsius to Fahrenheit. Each task is presented with code snippets and explanations for implementation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views10 pages

Python Basics: Functions & Patterns

The document contains a lab assignment by Srushti Vijay Uttarkar for FY BCA Division-B, focusing on programming tasks related to data types, flow control, and functions in Python. It includes programs for checking prime numbers, determining Armstrong numbers, calculating BMI, and printing various patterns, as well as a temperature conversion from Celsius to Fahrenheit. Each task is presented with code snippets and explanations for implementation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Tab 1

Srushti Vijay Uttarkar.


FY BCA
Division-B
Lab Assignment No.1

Topic: Data types,Flow Control and Function

[Link] a programme cheprime number given ck range.

start = int(input("Enter the start of range: "))

end = int(input("Enter the end of range: "))

print(f"Prime numbers between {start} and {end} are:")

for num in range(start, end + 1):


if num > 1: # Prime numbers are greater than 1
for i in range(2, int(num**0.5) + 1):
if num % i == 0:
break

else:
print(num)
[Link] python funtion for Check given number is armstrong or not

number = int(input("Enter a number: "))

if is_armstrong(number):

print(f"{number} is an Armstrong number.")


else:
print(f"{number} is not an Armstrong number.")
[Link] a program to calculate emi or bmi using a function.

h=float(input("Enter your height in meters: "))


w=float(input("Enter your Weight in Kg: "))

BMI=w/(h*h)

print("BMI Calculated is: ",BMI)

if(BMI>0):
if(MI<=16):

print("enter valid details")


print following pattern

rows = 5
k = 2 * rows - 2

for i in range(rows, -1, -1):

for j in range(k, 0, -1):


print(end=" ")

k=k+1
for j in range(0, i + 1):

print("*", end=" ")


print("")
printfollowing pattern

rows = 5
i=0
while i <= rows - 1:
j=0
while j < i:
# display space
print('', end=' ')
j += 1
k=i
while k <= rows - 1:
print('*', end=' ')
k += 1
print()
i += i = rows - 1
while i >= 0:
j = 0 while j < i:
print('', end=' ')
j += 1
k=i
while k <= rows - 1:
print('*', end=' ')
k += 1
print('')
i -= 1

rows = 14
print("*" * rows, end="\n")
i = (rows // 2) - 1
j=2
while i != 0:
while j <= (rows - 2):
print("*" * i, end="")
print("_" * j, end="")
print("*" * i, end="\n")
i=i-1
j=j+2

print following pattern

rows = 5
# rows = int(input("Enter the number of rows "))

for i in range(1, rows + 1):


for j in range(1, i + 1):
# multiplication current column and row
square = i * j
print(i * j, end=' ')
print()

[Link] a programme to temperature convert celsius to farenhite

c = float(input("Enter temperature in celsius: "))

f = (c * 1.8) + 32

print(str(c))
print(str(f))

You might also like