0
Can anyone please explain this
print("%d %f %s" % (7, 15, 28)) print("%.2f" % 369) print("%-10.2f%-10.2f" % (91, 23.456)) print ("%5.2f %5.2f $%5.2f" % (9,1.2, 55.78))
2 Answers
0
Ravikumar actually, in Python you don't need to specify data types for printing and declaring variables!
Maybe in C or similar languages you need to code:
#include <stdio.h>
int main(){
int a = 7;
printf("%d",a); //To output variable a!
return 0;
}
Well, in Python :
a = 7
print(a)
Seems a bit too easy now, doesn't it? đ€Łđ€Łđ€Ł
No semicolon, no declaring variable type, no printing variable type, much easier concatenation of string etc etc!
...but it is not without weakness. Python is slow compared to C and C++!
Happy programming! :)



