Menu

Sign in to track your progress and unlock all features.

Theme style

Log in

Full lesson preview

Create a Float Variable

Convert a numeric value into a float. Practice simple type conversion and returning values from functions.

Python practice6 minVariables & Data TypesBeginnerLast updated December 29, 2025

Problem statement

Given a numeric value (an integer or a float), convert it to a float and return the result. Do not print the result; return it from the function. The function should work for positive, negative, and zero values. Use Python's built-in conversion, and ensure the returned value is of float type.

Task

Write a function that takes a numeric input (int or float) and returns its float representation.

Examples

Integer to float

Input

create_float(5)

Output

5.0

The integer 5 converted to float is 5.0.

Float input stays float

Input

create_float(3.7)

Output

3.7

A float input should be returned as the same float value.

Input format

A single numeric argument (int or float) is passed to the function create_float(value).

Output format

Return a float corresponding to the input value.

Constraints

Do not print. Use the float conversion. The input will be a valid int or float.

Samples

Sample 1

Input

create_float(2)

Output

2.0

2 becomes 2.0 when converted to float.