10000 GitHub - Final-PythonFoundationHomework/type_conversion_homework
[go: up one dir, main page]

Skip to content

Final-PythonFoundationHomework/type_conversion_homework

Repository files navigation

📝 10 Easy Type Conversion Tasks for Students

1. int() Practice

Convert the string "5" and "42" to integers using int(). Print both results.

2. float() Conversion

Convert a string like "3.14" into a float and print the result.

3. str() Conversion

Take a number (e.g., 42) and convert it into a string using str().

4. bool() Test

Convert different values: number 0, number 1, empty string "", and text "hello" into boolean using bool(). Print each result with its type.

5. Add After Conversion

Convert two string numbers like "10" and "20" to integers, add them, and print the sum.

6. Concatenate vs Add

Explain and show the difference between "2" + "3" and int("2") + int("3").

7. Mixed Types

Convert an int to a float, and then to a str, and print all three versions.

8. Math Operations

Take the decimal number 15.7 and convert it to an integer using int(). Then convert 3.2 to an integer and multiply these numbers. Print the result.

9. Temperature Conversion

Convert the string temperature "36.5" to float, then convert it from Celsius to Fahrenheit using the formula: (celsius * 9/5) + 32.

10. Boolean Logic

Test different values with bool(): integer 0, integer 1, empty string "", text "hello", and float 0.0. Observe which values are "truthy" and which are "falsy".

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0