Computer Science, asked by smiley2376, 4 months ago

Write a python program to define a function with a name carttotal which accepts from the user the cost of each item
and no. of items purchased. This function stops accepting the input when the user presses the
control key. ​

Answers

Answered by AnushGudimetla
0

Answer:

import keyboard

def carttotal():

   while (True):

         givinginput = True

         while givinginput:

              no_of_items_purchased = int(input("Number of items purchased : "))

              cost_of_item = int(input("Cost of item : "))

         if keyboard.is_pressed('ctrl'):

         break

Similar questions