# Are You a Beginner Programmer? Build a Strong Foundation with These Projects

## Calculator

`def add(x, y):    return x + ydef subtract(x, y):    return x - ydef multiply(x, y):    return x * ydef divide(x, y):    return x / yprint("Select operation.")print("1.Add")print("2.Subtract")print("3.Multiply")print("4.Divide")while True:    choice = input("Enter choice(1/2/3/4): ")`

## Guess The Number

`import randomnum = random.randint(1, 100)guess = Nonewhile guess != num:    guess = input("guess a number between 1 and 100: ")    guess = int(guess)    if guess == num:        print("congratulations! you won!")        break    else:        print("Wrong Guess! try again!")`

## Sorting Algorithm

`employees = [    {'Name': 'ABC', 'age': 22, 'salary': 100000},    {'Name': 'DEF', 'age': 40, 'salary': 80000},    {'Name': 'GHI', 'age': 37, 'salary': 13000},    {'Name': 'JKL', 'age': 28, 'salary': 150000},]def get_name(employee):    return employee.get('Name')def get_age(employee):    return employee.get('age')def get_salary(employee):    return employee.get('salary')employees.sort(key=get_name)print(employees, end='\n\n')employees.sort(key=get_age)print(employees, end='\n\n')employees.sort(key=get_salary, reverse=True)print(employees, end='\n\n')`

--

--