Hello, I'm working on a lab and trying to execute the following code below but keep receiveing an "IndentationError: expected an indented block" for line item 4. Could somebody please explain how I could execute this code properly. #main.py def main(): #set constants *IndentationError: expected an indented block* QUARTER = 25 DIMES = 10 NICKEL = 5 PENNY = 1 #set totalcents=0 totalcents=0 #Get input values from keyboard print('Enter the number of quarters, dimes, nickels and pennies') quarters: int=int(input('Enter the number of Quarters: ')) dimes=int(input("Enter the number of Dimes: ")) nickels=int(input('Enter the number of Nickels: ')) pennies=int(input('Enter the number of Pennies: ')) #calculate total cents from quarters, dimes, nickel and pennies totalcents=quarters*QUARTER+dimes * DIMES +nickels * NICKEL +pennies * PENNY #calculate dollars dollars=int(totalcents/100) # calculate cents cents=totalcents%100 print("The total is ",dollars," dollars and ", cents, " cents") #calling main function main()
Hello,
I'm working on a lab and trying to execute the following code below but keep receiveing an "IndentationError: expected an indented block" for line item 4. Could somebody please explain how I could execute this code properly.
#main.py
def main():
#set constants *IndentationError: expected an indented block*
QUARTER = 25
DIMES = 10
NICKEL = 5
PENNY = 1
#set totalcents=0
totalcents=0
#Get input values from keyboard
print('Enter the number of quarters, dimes, nickels and pennies')
quarters: int=int(input('Enter the number of Quarters: '))
dimes=int(input("Enter the number of Dimes: "))
nickels=int(input('Enter the number of Nickels: '))
pennies=int(input('Enter the number of Pennies: '))
#calculate total cents from quarters, dimes, nickel and pennies
totalcents=quarters*QUARTER+dimes * DIMES +nickels * NICKEL +pennies * PENNY
#calculate dollars
dollars=int(totalcents/100)
# calculate cents
cents=totalcents%100
print("The total is ",dollars," dollars and ", cents, " cents")
#calling main function
main()
Step by step
Solved in 4 steps with 3 images