Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resubmit python basic homework #314

Merged
merged 6 commits into from
Jan 4, 2024

Conversation

WTLleo
Copy link

@WTLleo WTLleo commented Jan 4, 2024

拓展作业正在做

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@iphysresearch
Copy link
Owner

Good Job!!! @WTLleo

@iphysresearch
Copy link
Owner

Good Job!!! @WTLleo

@iphysresearch
Copy link
Owner

Good Job!!! @WTLleo

@iphysresearch
Copy link
Owner

Good Job!!! @WTLleo

Python homework:

  • Total questions: 108
  • Correct answers: 108
  • Score: 100.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 12
  • Score: 100.00%

@WTLleo
Copy link
Author

WTLleo commented Jan 4, 2024

434:
class Solution(object):
def countSegments(self, s):
count = 0
for i in range(len(s)):
if s[i] != ' 'and(s[i - 1] == ' 'or i == 0 ) :
count = count+1
return count
1869:
def checkZeroOn(self, s: str) -> bool:
ans=[]
start=s[0]
i=1
count=1
if sum(map(int,list(s)))==len(s):
return True
if sum(map(int,list(s)))==0:
return False
while i<len(s):
if s[i]==start:
count+=1
else:
start=s[i]
ans.append(count)
count=1
i+=1
ans.append(count)
if s[0]=="0":
max0=max(ans[::2])
max1=max(ans[1::2])
if max1>max0:
return True
else:
return False
if s[0]=="1":
#print(ans)
max1=max(ans[::2])
max0=max(ans[1::2])
if max1>max0:
return True
else:
return False

1784 :

class Solution:
def checkOnesSegment(self, s: str) -> bool:
return '01' not in s#s 组成的数字,两种情况:1 全部在最前且连续 或者s 不出现 01字符串

852:

class Solution(object):
def peakIndexInMountainArray(self, arr):
#严格递增。由于是不会出现在最左最右峰值,不必判断边界。
l,r = 0,len(arr)-1
while l <= r:
mid = (l+r) // 2
if arr[mid-1] <arr[mid] and arr[mid+1] < arr[mid]:
return mid
elif arr[mid-1] > arr[mid]:
r = mid
else:
l = mid

162:
class Solution:#二分查找
def findPeakElement(self, nums: List[int]) -> int:
left, right = 0, len(nums) - 1
while left < right:
mid = left + (right - left) // 2
if nums[mid] > nums[mid + 1]:
right = mid
else:
left = mid + 1

@iphysresearch
Copy link
Owner

Good Job!!! @WTLleo

Python homework:

  • Total questions: 108
  • Correct answers: 108
  • Score: 100.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 12
  • Score: 100.00%

@iphysresearch
Copy link
Owner

Good Job!!! @WTLleo

Python homework:

  • Total questions: 108
  • Correct answers: 108
  • Score: 100.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 12
  • Score: 100.00%

Copy link
Owner

@iphysresearch iphysresearch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WTLleo
完成Python基础+扩展作业,Matplotlib+Seaborn数据可视化作业,Sklearn建模和调参作业

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants