+ 1

int and string

how to print a string with an int of an assigned value num=1.2 int(print(" the whole number is: ",num)) expected output the whole number is: 1

31st Oct 2021, 7:49 AM
Namratha Nair
Namratha Nair - avatar
4 Respostas
+ 4
Namratha Nair you just need to store the int typecast value in an variable and then print that num=1.2 n=int(num) print(n)
31st Oct 2021, 7:51 AM
MsJ
MsJ - avatar
+ 2
In line number two you have written int(print(".....")) instead of print u need to write input if i am not wrong or if you are trying to print value in integer then simply u need to do casting like this print(int(num))
31st Oct 2021, 8:21 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
print( f"the whole number is : {num}")
31st Oct 2021, 8:06 AM
Richard
Richard - avatar
0
#Try this num=1.2 print(" the whole number is: ", int(num))
31st Oct 2021, 5:11 PM
Sousou
Sousou - avatar