Python
Python
Python
output:
Program:
import math
def calculate_area_in_acres(radius_in_feet):
area_in_acres = math.pi * (radius_in_feet**2) / 43560
return area_in_acres
output:
Program:
output:
Program:
import math
output:
program:
import random
def guess_number():
target_number=random.randint(1,9)
while True:
if user_guess==target_number:
print("well guessed!")
break
else:
guess_number()
output:
program:
for number in range(1, 51):
print("FizzBuzz")
elif number % 3 == 0:
print("Fizz")
elif number % 5 == 0:
print("Buzz")
else:
print(number)
output:
program:
nums = list(input("Enter a sequence of comma-separated 4-digit binary numbers: ").split(','))
print(res)
output:
program:
def count_even_odd(numbers):
even_count = 0
odd_count = 0
if num % 2 == 0:
even_count += 1
else:
odd_count += 1
output:
Program:
# calculate C = AB
for i in range(N):
for j in range(N):
sum = 0
for k in range(N):
sum += A[i][k] * B[k][j]
C[i][j] = sum
# print matrix C
for row in C:
print(row)
output:
Program:
def wobniar():
# Local variable with the colors of the rainbow
rainbow = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
output:
Program:
n = int(input("Enter the number of dictionaries: "))
my_dict = {}
for i in range(n):
key = int(input("Enter the key for dictionary {}: ".format(i+1)))
value = int(input("Enter the value for dictionary {}: ".format(i+1)))
my_dict[key] = value
output:
Program:
# Read the elements of the list from the user and append them to the list
for i in range(n):
elem = int(input("Enter element " + str(i+1) + ": "))
lst.append(elem)
output:
Program:
T = int(input())
for t in range(T):
N, K, P = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
count = 0
for i in range(1, N+1):
if i not in A:
count += 1
if count == P:
print(i)
break
if P > N-K:
print(-1)
output:
Program:
def bubble_sort(arr):
n = len(arr)
for i in range(n):
for j in range(n - i - 1):
if arr[j] > arr[j + 1]:
arr[j], arr[j + 1] = arr[j + 1], arr[j]
for i in range(n):
arr.append(int(input("Enter an integer: ")))
bubble_sort(arr)
print("Sorted list: ", arr)
output: