• Register
Log In
0 votes

Problem :

Need solution for bellow problem statement 
print the data members of inventorytag. ex: if item_id is 314 and quantity_remaining is 500, print:
6.9k points

1 Answer

0 votes

Solution :

Please find bellow the solution for your problem statement.

#Printing the data members of InventoryTag. Ex: if item_id is 314 and quantity_remaining is 500, print: ID: 314 Qty: 500

class InventoryTag:

def _init_(self):

self.quantity_remaining = 0

self.ID = 0


red_sweater = InventoryTag()

red_sweater.item_id = 314

red_sweater.quantity_remaining = 500

print("qty of inventory remaining")

print("%s is %d" %("ID", 314),end= " ")

print("%s is %d" %("quantity_remaining", 500))

36.1k points

Related questions

1 vote
1 answer 12 views
Problem: Hello Kodlogs, I am here with a problem. This could be a simple problem for you, guys, but it’s driving me crazy. I am in a situation that needs to print multiple values in a single line. Let me describe it in my words. Say, have some integer ... value in a different line and there is no option to concatenate them. Could you please help me out? Thanks for your concern and kind help.
asked Jun 2 adamSw 8.3k points
0 votes
1 answer 618 views
Problems : Assign the size of userInput to stringSize. Ex: if userInput = "Hello", output is: Size of userInput: 5 #include <stdio.h> #include <string.h> int main(void) { char userInputArray[50] = ""; int stringInputSize = 0; strcpy(userInputArray, "Hello"); /* Your solution starts here */ printf("Size of userInputArray: %d\n", stringInputSize); return 0; }
asked Dec 18, 2019 alecxe 7.5k points
1 vote
1 answer 15 views
Problem: I wrote this code to check if a number has same number of set and unset bits: def IsSame(x):     set, unset = 16, 16     # iterate for all bits of a number     while(x):         # if set         if (x and 1):             set + 1               ... ) But when I run this or compile this program it never shows any output, my terminal is aways blank. What should I do now? Thanks i advance.
asked Jun 7 samhaz 5k points
1 vote
1 answer 17 views
Probelm: I have 4 values that are: a = 9 b = 13.58 c = "allforallinall" d = [9, 13, 99] For those four values I tried to print which type of a variable they are, So I wrote this python program: a = 9 b = 13.58 c = "allforallinall" d = [9, 13, ... If this is not the way to print the type of a variable which is and how to print the type of a variable using a python program. Thanks in advance.
asked May 17 samhaz 5k points
0 votes
1 answer 19 views
Problem: Hello sir, I was working on the list concept but having little confusion that how can I check if the list is a subset of another list in python Though this is an easy question still needed the clarity properly on this if possible answer this sir soon.
asked Jun 4 Gavin 14.9k points