52769/create-vars-based-on-number-of-elements-on-the-list
Hey @Ashish, you can try something like this:
list = [1, 2, 3, 4] d = {'var%d' % el: None for el in list} d {'var4': None, 'var1': None, 'var3': None, 'var2': None}
Hello, The len() function can be used with several different ...READ MORE
The print() is getting called multiple times ...READ MORE
Hey @Neha, you can use something like ...READ MORE
Try using this question by list comprehension: a=[4,7,3,2,5,9] print([x for ...READ MORE
You can also use the random library's ...READ MORE
Syntax : list. count(value) Code: colors = ['red', 'green', ...READ MORE
can you give an example using a ...READ MORE
You can simply the built-in function in ...READ MORE
To count the number of elements of ...READ MORE
There are several options. Here is a ...READ MORE
OR
Already have an account? Sign in.