0

how to print number after message in while loop

i = 1 while i <= 6: print(i , " is a number") i=i+1 print("dejavu!") desired output is: 1 is a number 2 is a number 3 is a number 4 is a number 5 is a number 6 is a number

2nd Sep 2016, 12:05 AM
shaik sha
shaik sha - avatar
1 Resposta
0
also u can convert the number into string like print(str(i) + "what ever u want as") your programme will throw an type error,.. int and string concatenation can't be done. also give a look at new string formatting string.format() over internet, that might help u a lot
2nd Sep 2016, 3:37 AM
arvindh
arvindh - avatar