Converting for Fun | CyberStart Completion

Converting for Fun

Briefing:

I hope you’ve been making notes agent, as with this challenge you’ll need to take what you’ve just learnt about variables and try converting the types of data they contain.

Oh, handy tip: if you make a bit of a mess with your code editor you can always click the “Reset code” button on the bottom right. It’ll refresh the editor and put back the original text so you can start again.

Hint:

You can convert an integer to a string using the str() function, for example: converted = str(carDoors).

Always keep in mind what type of data a variable is holding, and convert between data types where you have to!

Code Solution:

The following code is the solution to this challenge. Please note that there may be alternative ways to complete this challenge.


# CHALLENGE 1: Convert carDoors to a string using type conversion.
# Save it in a new variable: carDoorsString
carDoorsString = str(carDoors)

# CHALLENGE 2: Print out the number of doors in the car
# using print(carInfo + carDoorsString)
print(carInfo + carDoorsString)