Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = [1,2,12,4,5,6]
- summ = 0
- for a1 in a:
- if a1==12:
- a1 = 0
- # print(a.index(a1)) # find the index number
- summ+=a1
- print(summ)
- print('\n\n')
- print('simple condition:\n')
- mail = 'abc@gmail.com.bd'
- passs = True
- if mail == 'abc@gmail.com.bd' and passs:
- print('success')
- elif mail == 'abc@gmail.com.bd' or passs:
- print('mail or password required')
- else:
- print('error')
- print('\n\nobject: \n\n')
- x = [2, 4, 5, 6]
- y = [2, 4, 5, 6]
- print(x == y) # list x and y is same
- print(x is y) # x & y is different object
- print('id of x: ' + str(id(x)) + ' & id of y ' + str(id(y))) # id of x & y
- x = y
- print(x is y) # x & y is same object
- print('id of x: ' + str(id(x)) + ' & id of y ' + str(id(y))) # id of x & y is same
- s = mail.split('.') # first split the mail according to '.'
- s2=[] # empty array
- for s1 in s:
- if s1=='bd':
- s.remove(s1) # remove the 'bd' from s list
- s2 = s # assing into new list
- con = ''
- for s3 in s2:
- # print(s3)
- con +=s3+','
- print(con[:-1]) # remove the last char ','
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement