'for' loop explanation request


I recently started learning python.
So I wrote some small code, this code asks for 2 sizes of lists,
creates 2 lists with random integers from 0-9 and then spits out the
intersection between two lists.



The last "for" loop - I had trouble with it because at first my
"intersection" list had repetitions, then I looked up for an answer
and got what I have now, it works, however I don't know why. My
problem is grasping how "for i in l1 and in l2" works?
I know that "for i in range(k)" is going through the numbers 0-k but
this strange for loop with the "and" operator just puzzles me.



l1 = []
l2 = []
C = []
s1 = int(input("Your 1st list size->"))
s2 = int(input("Your 2nd list size->"))
for i in range(s1):
from random import randint
k = (randint(0,9))
l1.append(k)
print("First List ->" , l1)
for i in range(s2):
from random import randint
k = (randint(0,9))
l2.append(k)
print("Second List ->" , l2)
for i in l1 and l2:
if i in l1 and l2:
C.append(i)

print("Intersection ->" , C)


Please let me know if there is another place to submit such
questions(if here is not for suitable).


- Technology - Languages
+ Webmasters
+ Development
+ Development Tools
+ Internet
+ Mobile Programming
+ Linux
+ Unix
+ Apple
+ Ubuntu
+ Mobile & Tablets
+ Databases
+ Android
+ Network & Servers
+ Operating Systems
+ Coding
+ Design Software
+ Web Development
+ Game Development
+ Access
+ Excel
+ Web Design
+ Web Hosting
+ Web Site Reviews
+ Domain Name
+ Information Security
+ Software
+ Computers
+ Electronics
+ Hardware
+ Windows
+ PHP
+ ASP/ASP.Net
+ C/C++/C#
+ VB/VB.Net
+ JAVA
+ Javascript
+ Programming
Privacy Policy - Copyrights Notice - Feedback - Report Violation 2018 © BigHow