# What if you have a variable of int data type but now want it to be used with values with decimals?
# Can you convert an integer data type to float data type?
# Do you know of functions that can help in conversion?
# Let us take a look
"""-----------Task 1: Expression Galore ---------------"""
print(" ")
print("*** Task 1: ***")
# Uncomment the statements and click Run:
a = input("Enter an integer value")
a = float(a)
b = input("Enter a float value")
b = float(b)
c = input("Enter another integer value ")
c = float(c)
expr = (a / b) * c
print ("result is: ", expr)
# Did you get an error? Do you know why?
# When you divide a number the result can be a decimal number.
# You got an error because when you use both integer and float data types, the computer gets confused.
# So you need to convert the variables to float data type. Do you know why we convert it to float data type?
# The mathematical calculation can give you a result with decimals. So we will have to convert it to float data type.
# To convert a variable to float data type, we use the float() function
#For example:
#d = input("Enter an integer value ")
#d=float(d)
# Go back to your code above and convert the int variable to float.
# Hint: You can do the following after accpeting the value from the user:
#a = float(a)
#b = float(b)
#c = float(c)
"""-------Task 2: Visit to the Stationery Shop -----------"""
print(" ")
print("*** Task 2: ***")
# Ready to write a program using different data types.
# Let's start by visiting the stationery shop.
# Ryan has been asked to take care of the accounts at the new stationery shop.
# The shop sells the following items:
# A Pack of Pencils (20 in number) - Rs.75
# A Pack of BallPoint Pens(5 in number)- Rs.30
# Long Size Notebook - Rs. 127.50
# Regular Size Notebook - Rs. 41.40
# Write a Python program for Ryan, to calculate the total amount,and generate the bill for the customer.
a = 75
a = float(a)
b = 30
b = float(b)
c = 127.50
d = 41.40
print(a+b+c+d)
"""-----------Task 3: Speed Conversion ------"""
print(" ")
print("*** Task 3: ***")
# Write a program to convert the speed from km/hr to m/s
# [Hint:To convert km/hr into m/sec, multiply the number by 5 and then divide it by 18.]
orig = input("Please enter your speed in kilometers per hour")
orig = float(orig)
print(f"\nYour speed in meters per seconds is {orig * 5 / 18}")
"""-----------Task 4: Area and Perimeter of Circle ------"""
print(" ")
print("*** Task 4: ***")
#Write a program to accept the radius of a circle, and calculate its area and perimeter.
#[Hint:Area = 3.14 * (radius) to power of 2 and Perimeter = 2*3.14*radius]
rad = input("Please enter the radius of a circle:")
rad = float(rad)
print(f"\nThe area of the circle is {3.14 * rad**2} \nThe perimeter is {2*3.14*rad}")
'''Awesome! You are becoming a pro in Python programming.You are mastering the use of data types in solving arithmetic problems'''
To embed this project on your website, copy the following code and paste it into your website's HTML: