首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在导入文件之后,实验室#3组合了python代码,从哪里开始呢?

在导入文件之后,实验室#3组合了python代码,从哪里开始呢?
EN

Stack Overflow用户
提问于 2022-11-10 03:20:46
回答 1查看 17关注 0票数 0

在导入我之前的两个问题文件之后,需要帮助找出从哪里开始。我试过的每一件事似乎都不想接受。所以我放弃了,想办法重新开始

代码语言:javascript
复制
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 -

月=输入()天=int(输入())

如果月份(‘12月',’一月‘,’二月‘):季节=’冬天‘伊莱夫月(’四月‘,’三月‘,’五月‘):季节=’春天‘埃利夫月(’六月‘,’七月‘,’八月‘):季节=’夏天‘:季节=’秋天‘

如果(月==‘>= 20)或(月==’4月‘)或(月==’6月‘)和(日>= 20):季节= 'spring’elif (月==‘==’)和( <= 21)或(月==‘7月’)或(月==‘8月’)或(月==‘9月’)和(月>= 21):季节=‘夏季’elif (月== )和(日期>= 22)或(月==‘10’)或(月==‘11月)。')或( ==‘12月’)和(第20天>= 20):季节= 'fall‘elif (月==’12‘)和(第21天<= 21)或(月==’1月‘)或(月==’二月‘)或(月==’3‘)和(第19天>= 19):季节=’冬天‘

印刷(季节)

代码语言:javascript
复制
Question_2 file code I have -

金额=输入()

如果金额<= 0:

代码语言:javascript
复制
 print(" No Change ")

否则:

代码语言:javascript
复制
 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")
代码语言:javascript
复制
EN

回答 1

Stack Overflow用户

发布于 2022-11-10 03:22:58

#因为它决定在上面显示奇怪的东西,分享下面的文件。这是question_2 ..。

金额=输入()

如果金额<= 0:

代码语言:javascript
复制
 print(" No Change ")

否则:

代码语言:javascript
复制
 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")
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74383781

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档