TypeError: can only concatenate str (not “float”) to str

前端 未结 3 2105
鱼传尺愫
鱼传尺愫 2020-11-28 16:03

I\'m trying to make a program that compares the density of a certain mass and volume to a list of densities of compounds, and return the type of compound I am analyzing.

3条回答
  •  一整个雨季
    2020-11-28 16:45

    Use formatted string

    str_val = "Hello"
    int_val = 1234
    msg = f'String and integer concatenation : {str_val} {int_val}'
    

    Output

    String and integer concatenation : Hello 1234
    

提交回复
热议问题