Skip to content

w0uldy0u/SWE_2021_41_2024_2_week_6

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

SWE_2021_41_2024_2_week_6

Week 4 Assignment

Week 4 Repository

def isHappy(n):
  while True:
    temp = 0

    for i in str(n):
      temp += int(i) ** 2

    n = temp

    if n == 4:
      return False
    elif n == 1:
      return True
  • The isHappy() function is used to determine whether the given number n is a happy number
  • To determine if a number is a happy number, we sum the squares of its digits, which is done by the for loop in the code
  • If a number is not a happy number, it will eventually fall into a endless cycle that includes 4
  • So if a number becomes 4 at some point, we know it's not a happy number and therefore the function returns False
  • According to the definition of happy number, if a number becomes 1, it is a happy number so the function returns True


Week 5 Assignment

Input

The command shows the OS information installed in the Docker container

docker exec ossp-container cat /etc/os-release

Output

PRETTY_NAME="Ubuntu 24.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.1 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo


Input

The command shows the version of Git installed in the Docker container

docker exec ossp-container git --version

Output

git version 2.43.0


Input

The command shows the version of Python installed in the Docker container

docker exec ossp-container python3 --version

Output

Python 3.12.3


Input

The command shows the path of mounted directory in the Docker container

docker inspect --format="{{ .HostConfig.Binds }}" ossp-container

Output

[/Users/space/Library/CloudStorage/OneDrive-성균관대학교/24-2/Open Source/Docker files:/mnt/ossp_container_dir]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published