Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4
In second snippet, where you read input into variable <text>, you have a chance to add verification code e.g. check <text> was not empty etc. There's little chance you can do such things with the first snippet, since you call input() directly on the event of printBill() invocation. I personally prefer the second snippet, but that's just me ...
23rd Mar 2022, 1:24 AM
Ipang