Strings and Lists in Python PYTHON by Ravinder Nath Rajotiya - April 19, 2019March 12, 20220 Strings Strings can be : Single quoted : 'Hello! I am here'. This is a single quoted string Double quoted : "Hello! i am here". This is double "" quoted string. Anything including escape sequence appear as it is, they are overridden Escape sequence be used anywhere (\n, \t, \a, \b and so on) Without print() string appear as it is, but with print () escape sequence have meaning In Python, single-quoted strings and double-quoted strings are the same. Pick a rule and stick to it. Improving readability When a string contains single or double quote characters, however, use the other one to avoid backslashes in the string. It improves readability. Example: We can use raw string with ‘r’ in print() function as: Problems working with strings In many cases,
Python Reserve Words and Data Types PYTHON by Ravinder Nath Rajotiya - April 19, 2019March 20, 20220 Setting the Path we started working with python in Calculator in Python. But it should also be noted that we need to set the path for the python if not set by default while installing python. This can be done on Windows Plateform as: set path=%path%;C:\python37 Typing an end-of-file character (Control-D on Unix, Control-Z on Windows) at the primary prompt causes the interpreter to exit with a zero exit status. If that doesn’t work, you can exit the interpreter by typing the following command: quit() Interactive Mode While working with python, we come across two types of prompts these are the primary and secondary prompt. primary prompt : when you start python prompt that appear is >>>. Secondary Prompt : … for continuous lines secondary prompt is … (three dots. >>> #