Data Types and Variables
[Link] the Data Type:
What will be the data type of the following values?
a) 42
b) 3.14
c) "Hello, World!"
d) True
2. Assign and Print Variables:
Assign the following values to variables and print them:
name = "John"
age = 30
is_student = False
[Link] Swapping:
Swap the values of two variables x and y without using a third variable.
Example:
x = 5
y = 10
# Swap the values
Arithmetic Operations
[Link] Calculations:
Write a program that assigns a = 15 and b = 4 and performs the following
operations:
Sum (a + b)
Difference (a - b)
Multiplication (a * b)
Division (a / b)
Floor Division (a // b)
Modulus (a % b)
Power (a ** b)
[Link] Perimeter and Area:
Write a Python program to calculate the perimeter and area of a rectangle
with the following dimensions:
Length = 10, Width = 5.
Type Conversion
[Link] Data Types:
Convert the following:
a) String "100" to an integer.
b) Integer 42 to a string.
c) Floating-point number 3.14 to an integer.
Print the results and their new data types.
[Link] and Conversion:
Write a program that asks the user for a number as input, doubles it, and
prints the result.
Example:
Enter a number: 7
Output: The double of your number is 14
[Link] the Square:
Write a program to take a number as input from the user and print its
square.
Example: