Posts

Showing posts from October 3, 2022

New Post

Python For Beginners - Python Basics

Image
PYTHON FOR BEGINNERS # Variables: Used to hold Values x = 200 y = 2 z = x+y print(z) OUTPUT: 202 # Careating Strings in Python r = 'Create stings' print(r) d = 'Don\'t Give Up' print(d) OUTPUT   Create stings Don't Give Up #Hold Values in Strings val = 50 disp = 'My Value is %s' print(disp % val) OUTPUT:  My Value is 50 #placeholder different variables - replace stings msg = '%s: Python is good' msg2 = '%s: Yes' c1 = 'Roy' c2 = 'Jhon' print(msg % c1) print(msg2 % c2) OUTPUT   Roy: Python is good Jhon: Yes #Hold Multiple Values  Hold= 'Add %s and %s' num1 = 23 num2 = 65 print(Hold % (num1,num2)) OUTPUT:   Add 23 and 65 #String Multiplication print(3 * 'R') OUTPUT:  RRR #How to use Space/Tab Space = ' ' * 10 print('%s Hello' % Space) print() print('%s Life = Peace' % Space) OUTPUT  :             Hello            Life = Peace #Create a String List and access Values from it. SimpleList
More posts