# 08-CS-UY 1114 Intro to Programming & Problem Solving

AI悦创原创PythonPython一对一教学Python一对一辅导Python 辅导编程一对一教学少儿编程一对一NYU编程辅导NYU Python辅导PythonPython一对一教学Python一对一辅导Python 辅导编程一对一教学少儿编程一对一NYU编程辅导NYU Python辅导大约 4 分钟...约 1343 字

## # Question 1

### # 3. Python 实现

``````a = int(input("请输入一个整数a: "))
b = int(input("请输入一个整数b: "))

numbers = []

for num in range(a, b+1):
for base in range(2, int(num**0.5)+1):
power = 2
while base**power <= num:
if base**power == num:
numbers.append((num, base))
power += 1

if numbers:
print(f"a到b之间可以表示为另一个数字的幂的数字及其对应的基数为：")
for num, base in numbers:
print(f"{num}可以表示为{base}的幂")
else:
print(f"a到b之间没有任何数字可以表示为另一个数字的幂。")
``````

## # Question 5

5. (30 points), New York state has a number of odd rules about paying employees. First, anyone who works more than 8 hours a day is paid overtime (1.5x pay rate) for the time in excess of 8 hours. For example, if you work 9 hours, you get paid 9.5 times your pay rate. (NYS law is 40 hours per week but, for this problem, we’re focusing on one day for ease in this problem)

• Basic minimum wage is \$15/hour in New York City.

• Spread of hours: Any employee whose workday ends more than 10 hours from their workday start time is paid one extra hour of basic minimum wage

• Split shift: Any employee whose work day is divided into two parts with more than 1 hour in between, is paid one extra hour at basic minimum wage

• Either split shift or spread of hours rule may apply to any workday, but not both!

1. For this task, you will write a program which asks the user for their pay rate, the start and end times of their first and second shifts (for ease, you can treat these like floats as a number of hours since midnight, i.e. 1:15pm would be listed as 13.25, 3:30pm as 15.50, etc.). Apply the above rules and print the amount that the person will be paid for that day. You can assume that all inputs will be valid and logical numerical values for a day’s calculations. If the person didn’t work a second shift, they will enter 0 for the start of their second shift.

1. Sample runs are below (with notes in italics)

AI悦创·编程一对一

AI悦创·推出辅导班啦，包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发、Web、Linux」，全部都是一对一教学：一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然，还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线，随时响应！微信：Jiabcdefh

C++ 信息奥赛题解，长期更新！长期招收一对一中小学信息奥赛集训，莆田、厦门地区有机会线下上门，其他地区线上。微信：Jiabcdefh

• 0
• 0
• 0
• 0
• 0
• 0

• 按正序
• 按倒序
• 按热度