Working with lists
finally i get the right result With my Code. But goes it easier? https://code.sololearn.com/cQsgd9J7zYi0/?ref=app
You can "zip" the two `list` and extend <lst> by a tuple created from comprehension. lst =  for ( value, counter ) in zip( times, people ): lst.extend( ( value for x in range( counter ) ) ) print( lst )
Using itertools.chain: https://code.sololearn.com/ciJHs57S13um/?ref=app
A quick C version with output in Python style. https://code.sololearn.com/cqOG5PXAdvnZ/?ref=app
Thanks @ all, so many new things for me.
You can do it using the Lambda and List comprehension: times = [0,1,2] people = [4,8,3] result =  y = lambda n: [((str(times[n]))*(people[n])) for n in range(3)] # print(y(n)) [[result.append(int(j)) for j in i] for i in y(n)] print(result) #range can be taken as (len(times)) or (len(people))
Yusra I recommend you to start Python for Beginners course on Sololearn https://www.sololearn.com/Course/Python-for-Beginners/?ref=app
Sir I want python code for 7425 ÷550
Pls I'm new and I don't understand any single thing in phython
Bro I want a help from you can you help me?
Problem Statement Given two integers a and b, your task is to calculate and print the following four values:
Please help, any idea?
Loop question, I've tried everything that I knew I just don't know. Please help me solve it out
Help me wiht python