+ 1

I want help in python

If i wanted to my computer that i want a random input from the user (int) but i want to add for it the unit for example 30 + kg = 30kg but i forgot how to do it

13th Aug 2024, 7:54 PM
😀ok
😀ok - avatar
5 Answers
+ 2
you can also use f-string to convert to string and concatenate in one step. num = int(input()) print( f'{num}kg')
15th Aug 2024, 1:33 AM
Bob_Li
Bob_Li - avatar
+ 2
You have an integer and a string now. Just convert the integer into a string then concatenate both.
13th Aug 2024, 9:22 PM
Ruben
+ 1
You can re-read all lessons previously completed.
14th Aug 2024, 7:08 PM
Ruben
0
I forgot how to do it it been 2 weeks since last time i used sololearn đŸ˜…đŸ€ŁđŸ€Ł
14th Aug 2024, 12:46 PM
😀ok
😀ok - avatar
0
you can use str(Other type of value) for that print(str(30) + “kg”)
15th Aug 2024, 2:23 PM
Arch Linux
Arch Linux - avatar