第 4 步:让我们使用我们刚刚学到的关于在integers和strings之间进行转换的知识。

更改变量的数据类型称为强制转换。

  • 转到逻辑,单击并拖入Convert to String 。将其放在程序的底部。
  • 将str()中的变量从my_var为roll_1 。
  • 将=左侧的变量从my_var为roll_1_string 。

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)