• Register
0 votes
86 views

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 6 views
6 views
Problem: Hello Guys, I am a new member of this forum. I recently started learning computer programming and I started with Python. One of my friends recommended this forum, and here I am! Anyway, I have come with a very fundamental question and its a must to answer. What is stderr and how do you usee it in Python? Thanks for your answers. I must recognize your help.
asked 5 days ago adamSw 11.3k points
1 vote
1 answer 18 views
18 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 11.3k points
0 votes
1 answer 681 views
681 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
0 votes
1 answer 6 views
1 vote
1 answer 17 views
17 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