Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Casting in Python Challenges

# Question

1. Assume you have the integer d = 23, write a Python program to find:
a. float (d)
b. str(d)
Expected output:
a. 23.0
b. 23
2. Assume you have e = 47, st = ' python ', try the following:

a. list(e)

b. int(st)

Expected output:

a. TypeError: 'int' object is not iterable

b. ValueError: invalid literal for int() with base 10: 'python'

Kuala Lumpur, Malaysia, phone: +601160906599, e-mail:academysamer@gmail.com


# Question

3. Assume you have st = '12', s = 34.45, write a Python program to find:


a. int(st)
b. int(s)
Expected output:
a. 12
b. 34

To find out more about Python, web development, and data science visit us on:

Kuala Lumpur, Malaysia, phone: +601160906599, e-mail:academysamer@gmail.com

You might also like