PDF for Cs Project
PDF for Cs Project
it
Answer- input
# Ask the user for a welcome message
welcome_message = input("Enter your welcome
message: ")
output
Enter your welcome message: how are you
Your welcome message is: how are you
Answer-
Input - # Ask the user for three numbers
num1 = float(input("Enter the first number: "))
num2 = float(input("Enter the second number: "))
num3 = float(input("Enter the third number: "))
Output
Enter the first number: 30
Enter the second number: 60
Enter the third number: 90
The largest number is: 90.0
The smallest number is: 30.0
# Example usage
num_list = [3, 1, 4, 1, 5, 9]
num_tuple = (3, 1, 4, 1, 5, 9)
largest_list, smallest_list =
find_largest_smallest_list(num_list)
largest_tuple, smallest_tuple =
find_largest_smallest_tuple(num_tuple)
output-
Largest in list: 9, Smallest in list: 1
Largest in tuple: 9, Smallest in tuple: 1
gcd = compute_gcd(a, b)
return abs(a * b) // gcd
gcd = compute_gcd(a, b)
return abs(a * b) // gcd
gcd = compute_gcd(a, b)
return abs(a * b) // gcd
input
Enter a list of numbers separated by spaces: 1 2 3 4 5 6
List after swapping even and odd elements: [2, 1, 4, 3, 6,
5]