Quantcast
Viewing all articles
Browse latest Browse all 14126

How to concatenate values from different lists together? [duplicate]

I am trying to write code that will repeat for x values from one list, y values from another list, and z values from the last list. The list values would be from user input in a previous line of code. I want to concatenate these values into a single print statement.

The list values would be from user input in a previous line of code.

This is the original code:

NCACost = [123,234,345]NCADepr = [23,34,45]NCANBV = [100,200,300]for x in NCACost:    for y in NCADepr:        for z in NCANBV:            print(str(x) +' - end=')            print(str(y) +' = end=')            print(str(z))

What I wanted:

123 - 23 = 100234 - 34 = 200345 - 45 = 300

Viewing all articles
Browse latest Browse all 14126

Trending Articles