实验#3在导入文件后组合python代码,我从哪里开始?



需要帮助弄清楚在我导入之前的两个问题文件后从哪里开始。我尝试过的一切似乎都不想接受。所以我放弃了它,并试图找出从哪里重新开始


1.  In a file called FirstName_LastName_Main.py import Question_1.py and Question_2.py modules.
2.  Prompt and read in the month followed by the day from the user. Note: month is of type String and day is of type int.
3.  Call Seasons function from Question_1 module with the user’s input as arguments and print the season returned by the call to the function.
4.  Prompt and read the total change amount from the user. Note: the total change is an integer.
5.  Call the Exact_Change function from Question_2 module with the user’s input as it’s argument.  

Sample Output:
Ex. If the input is:
Enter the month:  April
Enter the day:  30
Output:
April 30: Spring
Ex. If the input is:
Enter the exact change in cents: 123
Output:
1 Dollar
2 Dimes
3 Pennies

question_1 file code I have -

month = input()日期= int(input())

if month in ('December', 'January', 'February'):季节="冬天"if month in('四月','三月','五月'):季节="春天"if month in ('June', 'July', 'August'):季节="夏天"其他:Season = 'fall'

if (month == 'March') and (day>= 20) or (month == 'April') or (month == 'June') and (day>= 20):季节="春天"elif (month == 'June') and (day <= 21) or (month == 'July') or (month == 'August') or (month == 'September') and (day>= 21):季节="夏天"elif (month == 'September') and (day>= 22) or (month == 'October') or (month == 'November') or (month == 'December') and (day>= 20):季节="秋天"elif (month == '十二月')及(day <= 21)或(month == '一月')或(month == '二月')或(month == '三月')及(day>= 19):Season = 'winter'

打印(季节)


Question_2 file code I have -

amount = input()

if amount <= 0:

print(" No Change ")

:

dollar = int(amount / 100)
amount = amount % 100
quarter = int(amount / 25)
amount = amount % 25
dime = int(amount / 10)
amount = amount % 10
nickel = int(amount / 5)
penny = amount % 5

if dollar >= 1:
if dollar == 1:
print(str(dollar)+" Dollar")
else:
print(str(dollar)+" Dollars")
if quarter >= 1:
if quarter == 1:
print(str(quarter)+" Quarter")
else:
print(str(quarter)+" Quarters")
if dime >= 1:
if dime == 1:
print(str(dime)+" Dime")
else:
print(str(dime)+" Dimes")

if penny >= 1:
if penny == 1:
print(str(penny)+" Penny")
else:
print(str(penny)+" Pennies")
if nickel >= 1:
if nickel == 1:
print(str(nickel)+" Nickel")
else:
print(str(nickel)+" Nickels")

# #因为它决定在上面展示下面共享的文件。这是问题2…

amount = input()

if amount <= 0:

print(" No Change ")

:

dollar = int(amount / 100)
amount = amount % 100
quarter = int(amount / 25)
amount = amount % 25
dime = int(amount / 10)
amount = amount % 10
nickel = int(amount / 5)
penny = amount % 5

if dollar >= 1:
if dollar == 1:
print(str(dollar)+" Dollar")
else:
print(str(dollar)+" Dollars")
if quarter >= 1:
if quarter == 1:
print(str(quarter)+" Quarter")
else:
print(str(quarter)+" Quarters")
if dime >= 1:
if dime == 1:
print(str(dime)+" Dime")
else:
print(str(dime)+" Dimes")

if penny >= 1:
if penny == 1:
print(str(penny)+" Penny")
else:
print(str(penny)+" Pennies")
if nickel >= 1:
if nickel == 1:
print(str(nickel)+" Nickel")
else:
print(str(nickel)+" Nickels")

相关内容

最新更新