简体   繁体   中英

Getting Different O/P on python2.7 & python 3.5

I'm just a beginner in python. I was just writing some code to print table of any number and I surprisingly got different answers on python v2.7 & python v3.5! This occur only when I use string function, not when I use comma(,).

两个终端的屏幕截图

The difference is the type of 'n'. It is treated as an integer than you get the numeric operation ' ', in the other case it is treated as string with the string operation ' '. Try out type(n) after you read it and you will see the difference.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM