Skip to content
Debug 3.4. Parse Input with starter code
  • Pages
    • The Task
    • icon picker
      Python Starter Code
    • Code Clips

Python Starter Code

Copy and paste the code below into your main.py file before you begin the task.
import time

# blank line
print('\n\n')
# ASKS the user to enter the name of Krispy Kreme doughnut
doughnutName = float(input('Enter doughnut name: '))

# ASKS the user to enter the description of the Krispy Kreme doughnut
description = int(input('Enter doughnut description: '))

# ASKS the user to enter the kcal of the Krispy Kreme doughnut
kcal = int(input('Enter kcal: '))

# ASKS the user to enter if collection is available for Kirspy Kreme doughnut
collection = bool(int(input('For collection? (enter 1-True or 0-False): ')))

# ASKS the user to enter cost of Kirspy Kreme doughnut
cost = int(input('Enter cost: £'))
# blank line
print('\n\n')
# DISPLAY processing doughnut message
print('Uploading doughnut....')

# pauses program for 3 seconds
time.sleep(3)
# clears screen
print('\033[H\033[2J')

# blank line
print('\n\n')
# DISPLAY Krispy Kreme title
print("Krispy Kreme Doughnut")
print("--------------------")
# DISPLAY user output
print('Doughnut name: ' + doughnutName)
print('Doughnut description: ' + description)
print('kcal: ' + kcal)
print('Collection: ' + collection)
print('Cost: £' + cost)
 
Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.