Python Basic Ws
Python Basic Ws
x = 5
y = 10
# Swap x and y
2. Write a Python program to calculate the sum of two numbers provided by the
user.
# Input: 3, 5
# Output: 8
3. Write a program that takes a number as input and prints whether it is even or
odd.
4. Write a Python program to find the largest of three numbers.
5. Write a Python program to swap two variables using a temporary variable.
1. Write a program to display the type of variable for the following inputs: 5, 5.0,
"Hello", [1, 2, 3], (1, 2, 3), {1, 2, 3}.
2. Write a program to accept a string from the user and print it in reverse.
3. Create a variable of type float, then convert it into an integer and print the
result.
4. Create a program to demonstrate implicit and explicit type conversion.
5. Write a program that takes two inputs and checks if they are of the same data
type.