UrbanPro
true

Learn Python Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Two lists using Loops - Python Program 1

Arpan
04/04/2023 0 0

To generate a list of all possible combinations of two lists using loops, you can use nested loops to iterate through both lists and create a new list that contains all the combinations.

list1 = [1, 2, 3]
list2 = ['a', 'b', 'c']
combinations = []

for i in list1:
  for j in list2:
    combinations.append((i, j))

print(combinations)

0 Dislike
Follow 1

Please Enter a comment

Submit

Other Lessons for You

Write your first Python program in 10 minutes
1. Download python from python official site search "python download" in google 2. Install in your machine 3. verify using : "python --version" command 4. Write first program using notepad create...

Python Script for random Password generation
from random import randintdef passwordgen(request): str_not_include = "1 L I i l o O 0" str_small ="abcdefghjkmnpqrstuvwxyz" str_caps = str_small.upper() str_num = "23456789" str_special...

Write a python program to display dictonary details from list of dictonary
Print the Following: Print all dictonary in a seperate line. Name of all the products. Total quantity of all the products. Details of any product name when provided. Convert all the product name to upper case and print.
A

Ankit P.

0 0
0

Difference between Python 2.x and Python 3.x
Python 2.x and Python 3.x differs in following features: Division operator print function Unicode xrange Error Handling __future__ module

Multiple Decorators
#Multiple decorators can be chained in Python.#A function can be decorated multiple times with different (or same) decorators.#We simply place the decorators above the desired function. def star(func):...
X

Looking for Python Training Classes?

The best tutors for Python Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Python Training with the Best Tutors

The best Tutors for Python Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more