Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Question: 04
- my_list = [42, "Hello, GPT-3.5!", 3.14, True, ['a', 'b', 'c'], {"key": "value"}, None, (1, 2, 3), 7.5, False]
- for element in my_list:
- print(f"Element: {element}, Data Type: {type(element)}")
- # Question: 05
- # Taking input for numbers A and B
- A = int(input("Enter the dividend (A): "))
- B = int(input("Enter the divisor (B): "))
- # Initializing a variable to count the number of divisions
- count = 0
- # Checking if B is not zero to avoid division by zero error
- if B != 0:
- while A % B == 0:
- # Dividing A by B and updating the value of A
- A = A / B
- # Incrementing the count of divisions
- count += 1
- print(f"{A} is not divisible by {B}.")
- print(f"{count} times {B} divides {A} evenly.")
- else:
- print("Error: Cannot divide by zero. Please enter a non-zero divisor.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement