ICP1 - naveenamadepally13/PythonDeeplearning GitHub Wiki
1. Diff between Python version 2 and 3
- Division operator : In version2 7 / 5 is rounded to 1 but in version3 the output is 1.4 the exact value.
- **print function : ** Braces are used for print function in version3. print('Hello') - v3 print Hello - v2
- Unicode : In Python 2, implicit str type is ASCII. But in Python 3.x implicit str type is Unicode.
- **xrange : ** Xrange() is removed in v3 instead range() is used.
- Error Handling: In python 3.x, ‘as’ keyword is required fro error handling in version2 it is not used. try: trying_to_check_error except NewError as err: # 'as' is used in Python 3.x print (err, 'Error Caused')
ICP 1 and 2 programm and out put.