How can I enter two variables in the for loop? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can I enter two variables in the for loop?

4th Dec 2020, 10:13 AM
Parham Shafiei Sabet
Parham Shafiei Sabet - avatar
2 Answers
+ 10
Parham Shafiei Sabet Example - for i in array: do_something(i) One more things If you need the index in the array for some reason (usually you don't), then do this - for i, element in enumerate(array): print("working with index", i) do_something(element) Hope this will help! Btw I think it can be even clear when you'll start the course..
4th Dec 2020, 1:27 PM
Piyush
Piyush - avatar
+ 2
For i in range(2): A=int(input ()) B=input()
4th Dec 2020, 10:17 AM
Sâñtôsh
Sâñtôsh - avatar