-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.py
More file actions
34 lines (23 loc) · 704 Bytes
/
functions.py
File metadata and controls
34 lines (23 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
""""
This module practice working with functions.
"""
def hello_world():
print("Hello, World!")
def greeting(greeting, name="Hamid"):
# print("{} {}".format(greeting, name))
print(f"{greeting} {name}.")
def student_info(*args, **kwargs):
print(args)
print(kwargs)
def is_leap(year):
""" Return True for leap years, False for non-leap years. """
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
hello_world()
greeting("Hello")
greeting("Hello", "John")
student_info("Math", "Art", name="John", age=25)
courses = ["Physics", "Chemistry"]
student = {"name": "Joe", "age": 30}
student_info(*courses, **student)
print(is_leap(2017))
print(is_leap(2020))