Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''core python'''
- '''#type()
- a="parthiduce"
- b=6
- c=5.0
- d=5+1j
- type(a)
- type(b)
- type(c)
- type(d)
- #variables
- a=int(input("enter the number"))
- b=input("enter name")
- ##operators
- #arithmatic(+,-,*,/,**,//)
- #assignment(a+=10,a-=2)
- #logic(a==10&&b==6)(a or b)(a not b)
- #bitwise(&,|,^,>>,<<,~)
- #membership(in,not in)
- #identify(is,is not)
- ##conditional statements
- #if
- a=6
- if a==6:
- print("parthi duce")
- #if else
- a=6
- if a==5:
- print("parthi")
- else:
- print("duce")
- ##elif
- a=6
- b=7
- if a==5:
- print("done")
- elif b==6:
- print("success")
- elif a==6:
- print("bravo")
- else:
- print("good")
- ##nested if
- a=5
- b=6
- if a==5:
- if b==6:
- print("parthi duce")
- else:
- print("ranaa")
- else:
- print("musoo")
- ##looping
- #while
- a=1
- while a<10:
- print(a)
- a=a+1
- #for
- a=10
- for i in a:
- print(i)
- #nested while
- a=1
- b=10
- while(a<10):
- print(a)
- b=10
- while b<20:
- print(b)
- b=b+1
- a=a+1
- ##collection
- #list
- list1=[1,2,3,4,"duce","musoo"]
- list2=[5,6,7,8]
- len(list1)
- max(list2)
- min(list2)
- list2.append(40)
- list2.insert(20)
- list2.pop(2)
- list2.remove(1)
- list2.sort()
- list2.reverse()
- list2.extend(list1)
- #tuples
- t1=(1,2,3,4)
- len(t1)
- max(t1)
- min(t1)
- t1.count()
- t1.index(2)
- #set
- s1={1,2,3,4,"parthi","ranaa","musoo"}
- s2=set()
- s1.add(5)
- s1.remove(5)
- s1.union(s2)
- s1.intersection(s2)
- s1.difference(s2)
- s1.pop(2)
- #dict
- d={"a":1,"b":2,"c":3}
- for i in d.keys():
- print(i)
- for i in d.values():
- print(i)
- for i in d.items():
- print(i)
- '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement