01_Book.py
def var():
print("it's a variable")
def str():
print("it's a string")
def loop():
print("it's a loop")
def func():
print("it's a func")
def book():
print('''learn
1. var
2. str
3. loop
4. func''')
page = int(input("Enter page no: "))
def test(page):
if page == 1:
var()
elif page == 2:
str()
elif page == 3:
loop()
elif page == 4:
func()
else:
print("choose correctly")
home = input('''go to home (h):
go to previous page (p):
go to next page (n):''')
if home == "h":
book()
elif home == "p":
page = page-1
test(page)
elif home == "n":
page = page+1
test(page)
else:
print("Error")
test(page)
book()
No comments:
Post a Comment