Getting started guide.
print("I\'m exicted") #how to include quotes str1="Thank" str2="You" print(str1+str2) #concatenate strings double_val = 1.1 int_val = a=int_val print(a) print("a="+) #converting double to integer #converting interger to variable #printing variable and variable as string print('Every expert was\nOnce a begineer') #new line print("Please! "*100) #printing same string
if(True): print("condition is true") #if condition is true;the above line will be executed; #change the condition to False and try myMood="happy" if(myMood=="happy"): print("I'm so happy :)") else: print("I'm confused!")
if(a%2==0): print("yes, it's even number") else: print("no, it's odd number") a=
for i in : print(i) #prints 0 to 9
i=0 while(i<10): print(i) i+=1
##example1 print("Have a good day") #calling greet userDefFunction ##example2 "fucntion docs: About this function here for author ref" print("Have a good day "+name) ##example3 if(a%2==0): return True else: return False #NOTE: you can only ip str variable types #NOTE: once *return True* is executed, it ends.
num=7 den=3 quotient=7//3 reminder=7%3 print(quotient) print(reminder)
py_list= if("eggs" in py_list): print("already in list") else: print("adding to list") py_list #adds to the list end edges1= cubes1= cubes2= #list-comphrehension edges2= import random #imporing a library edges3= #includes int 5 and 10 cubes21=
dict_var = print() dict_var #updating a new value pair print(2 in dict_var) #returns *True*; checks the key 2 print("dos" in dict_var) #returns *False*; "dos" is value of key 2; not is key list mixed_var= print() #use only when you are sure about key "apples" is present print(mixed_var) #use get() if you are not sure of the key print(mixed_var) #this returns *None* #note: use only var[] to call
import random #python module which has many functions like randint() i=random import random as rnd #importing a module with nick name j=rnd print(j) import math as mathModule print(mathModule) from math import pi, sqrt #imporing only specifed constans and functions instead of all from math import sqrt as square_root print() print(pi) print()