python version
import sys
print("My python version Number: {}".format(sys.version))
My python version Number: 3.7.3 (default, Mar 28 2019, 10:38:38) [MSC v.1915 32 bit (Intel)]
using python sheell
using sys and os
import os
for i in range(2,10):
input_string = str(i)
os.system(input_string)
List Comprehension
list1 = [i for i in range(2,10)]
print(list1)
[2, 3, 4, 5, 6, 7, 8, 9]
slicing
list1 = [3,4,5,6,7,8]
list1[1:4]
[4, 5, 6]
Dictionaries and Sets
example1 = [i for i in range(5)]
example2 = [i for i in range(3,8)]
example3 = example1 + example2
print(example1)
print(example2)
print(example3)
set_example1 = set(example3)
print(set_example1)
[0, 1, 2, 3, 4]
[3, 4, 5, 6, 7]
[0, 1, 2, 3, 4, 3, 4, 5, 6, 7]
{0, 1, 2, 3, 4, 5, 6, 7}
dict_example = {'Bob' : 21, 'Chris' : 33, 'Dave' : 40}
print(dict_example)
dict_example['Adam'] = 11
print(dict_example)
print(dict_example['Bob'])
{'Bob': 21, 'Chris': 33, 'Dave': 40}
{'Bob': 21, 'Chris': 33, 'Dave': 40, 'Adam': 11}
21
file management
with open("hello.txt" ,'a') as txt:
txt.write("hello")
class and function
def count_zeros(string):
total=string
return total
print(count_zeros('00102'))
00102
In questa pagina del sito puoi guardare il video online Eight things every programmer should know della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Deeper Coders 02 febbraio 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 27 volte e gli è piaciuto 0 spettatori. Buona visione!