# gender = input("Gender? ")
# if gender == "male" or gender == "Male":
#     print("Your cat is male")
#     print(" Your cat is transman")
# else:
#     print("Your cat is female")

# age = int(input("Age of your cat? "))
# if age < 5:
#     print("Your cat is young")
# else:
#     print("Your cat is adult")

# between = int(input("Give me a number? "))
# if between < 10:
#     print(between) 
# else:
#     print("Invalid number")

# number = int (input("Give me a number "))
# if number % 2 == 0:
#     print("Even")
# else:
#     print("Odd")

# city = ['Tokyo', 'New York', 'Toronto', 'Hong Kong']
# print('Cities loop:')
# for x in city:
#     print('City: ' + x)

# num = [1, 2, 3, 4, 5, 6, 7, 8, 9]
# print('x^2 loop:')
# for x in num:
#     y = x * x
#     print(str(x) + '*' + str(x) + '=' + str(y))

# for x in range(100):
#     print(x)
# else:
#     print(x + 1)

# for x in range(1, 101):
#     print(x)

# for x in range(11):
#     print(x)

# for n in range(2, 10):
#     for x in range(2, n):
#         if n % x == 0:
#             print(n, 'equals', x, '*', n//x)
#             break
#         else:
#             print(n, 'is a prime number')

# x = 3
# while True:
#     print(x)
#     x= x + 1


# nums = [1, 2, 3 , 4, 5]

# for num in nums:
#     for letter in 'abc':
#         print(num, letter)

# def hello_func():
#     print('Hello')

# hello_func()

# def hello_func(greeting, name='You'):
#     return '{}, {}'.format(greeting, name)

# print(hello_func('Hi'))

# def currentYear():
#     print('2018')

# currentYear()

# def f(x, y):
#     x = int(input('Give me a number'))
#     return x
#     y = int(input('Give me a number'))
#     return y

# print(f())

# fruits = ['papple', 'orange', 'pgrapes']
# for i in fruits:
#     if i[0] == 'p':
#         print(i)

# y = [6, 4, 2]
#     for i in y:
#         if i == 4:
#             print(i)

# s = "My lucky number is " + str(7) + ", what is yours?"
# print(s)

# s = "Hello World"
# xs = s.replace("World", "Universe")

# print(xs)

# s = "John Paulo Barbin"
# x = input("Enter ")
# if x in s:
#     print("query found " + x)
# else:
#     print("not found " + x)

# first = "Bugs"
# last =  "Bunny"

# sequence = (first, last)

# name = " ".join(sequence)
# print(name)

# myTuple = ("John", "Peter", "Vicky")

# x = "#".join(myTuple)
# print(x)

# word = "Easy"

# x = list(word)
# print(x)

# mes = "Bobby's World"
# mess = 'Bobby\'s World'

# print(mes, mess)

# In the open(), the first argument is a string that contains a filename. The second argument is a mode describing the way in which the file will be used.

# In the open(), there are modes in the second argument that you can use, the 'r' stands for Read which open the file for reading.  The 'a' Append opens a file for appending. The 'w' Write opens a file for writing. Creates the file if it does not exist and the 'r+' opens the file for both writing and reading

# Use the with keyword when dealing with file objects. Even without writing the f.close(), it will automatically closes the file after its suites finishes. 

# The read() method returns the whole output. but if use readline(), returns the data in single line

# try: 
# 	a = 10/0
# 	print a 
# except ArithmeticError: 
# 		print "This statement is raising an arithmetic exception."
# else: 
# 	print "Success."

# def scope_test():
#     def do_local():
#         spam = "local spam"

#     def do_nonlocal():
#         nonlocal spam
#         spam = "nonlocal spam"

#     def do_global():
#         global spam
#         spam = "global spam"

#     spam = "test spam"
#     do_local()
#     print("After local assignment:", spam)
#     do_nonlocal()
#     print("After nonlocal assignment:", spam)
#     do_global()
#     print("After global assignment:", spam)

# scope_test()
# print("In global scope:", spam)

# class MyClass:
#     variable = "blah"

#     def function(self):
#         print("This is a message inside the class.")

# myobjectx = MyClass()
# myobjecty = MyClass()

# myobjecty.variable = "yackity"

# print(myobjectx.variable)
# print(myobjecty.variable)

# class MyClass:
#     variable = "blah"

#     def function(self):
#         print("This is a message inside the class.")

# myobjectx = MyClass()

# myobjectx.function()

# class MyClass:
# 	x = 5

# p1 = MyClass()
# print(p1.x)

# class Person:
# 	def __init__(self, name, age):
# 		self.name = name
# 		self.age = age

# 	def myfunc(self):
# 		print("Hello! My name is " + self.name)

# p1 = Person("John", 22)
# p1.myfunc()

# print(p1.name)
# print(p1.age)

# class Bag:
#     def __init__(self):
#         self.data = []

#     def add(self, x):
#         self.data.append(x)

#     def addtwice(self, x):
#         self.add(x)
#         self.add(x)

# newBag = Bag()
# newBag.add('willis')
# newBag.addtwice('gucci')
# print(newBag.data)

# a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
# l = []
# for i in a:
# 	if i <= 5:
# 		l.append(i)

# print(l)

# a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]

# for i in a:
# 	if i <= 5:
# 		x = []
# 		x.append(5)
# 		print(i)
# 	else:
# 		pass

# num = int(input("Please choose a number to divide: "))

# listRange = list(range(1,num+1))

# divisorList = []

# for number in listRange:
#     if num % number == 0:
#         divisorList.append(number)

# print(divisorList)

# class Person:
# 	def __init__(self, fname, lname):
# 		self.firstname = fname
# 		self.lastname = lname
	
# 	def printname(self):
# 		print(self.firstname, self.lastname)

# class Student(Person):
# 	pass

# x = Student("Trizha", "Longaza")
# x.printname()


# class Employee:
# 	def __init__(self, first, last, pay):
# 		self.first = first
# 		self.last = last
# 		self.pay = pay
# 		self.email = first + '.' + last + '@company.com'

# 	def fullname(self):
# 		return '{} {}'.format(emp_1.first, emp_1.last)

# emp_1 = Employee('Sam', 'Lopez', 50000)


# print(emp_1.fullname())

# str = input("Enter the string: ")
# l = len(str)
# p = l-1
# index = 0
# while index < p:
#     if str[index] == str[p]:
#         index = index + 1
#         p = p-1
#         if index == p or index + 1 == p:
#             print("String is a palindrome")
#     else:
#         print("string is not a palindrome")
#         break
	
# class Account:
#      def __init__(self, name, money):
#          self.name = name
#          self.money = money

# input = input("What's your name? -->")
# aaccount = Account(input,10000)

# print(aaccount.name, aaccount.money)

# class StackOverflowUser:
#         def __init__(self, name, userid): 
#             self.name = name
#             self.userid = userid

# name = input("Enter name: ")
# userid = int(input("Enter user id: "))


# dave = StackOverflowUser(name, userid)

# print('{} {}'.format(dave.name, dave.userid))

# class Palindrome:
#     def __init__(self):
#         self.items = []
 
#     def is_empty(self):
#         return self.items == []
 
#     def push(self, data):
#         self.items.append(data)
 
#     def pop(self):
#         return self.items.pop()
 
 
# s = Palindrome()
# text = input('Please enter the string: ')
 
# for character in text:
#     s.push(character)
 
# reversed_text = ''
# while not s.is_empty():
#     reversed_text = reversed_text + s.pop()
 
# if text == reversed_text:
#     print('The string is a palindrome.')
# else:
#     print('The string is not a palindrome.')

# import random

# while True:
#     rolled_num = random.randint(1,6)
#     print("The dice rolled and you got: ", rolled_num)
#     input("Press any key to roll again.")

# import random
# class RollTheDice(object):

#     def __init__(self):
#         self.min = 1
#         self.max = 6
#         super(RollTheDice, self).__init__()

#     def ask_something(self):
#         while True:
#             userInput = str(input("Roll Again? Yes or No" + "\n"))
#             if (userInput == "Yes" or userInput == 'Y'):
#                 self.rollDice()
#             else:
#                 print("You didn't type 'Yes' or 'Y' no roll for you. Bye....")
#                 exit()

#     def rollDice(self):
#         print ("Rolling the dices...")
#         print ("The values are....")
#         print (random.randint(self.min, self.max))

# RollTheDiceObject = RollTheDice()
# RollTheDiceObject.ask_something()

# import random

# class Dice:
#     def __init__(self):
#         self.roll = random.randint(1, 6)

#     def toRoll(self):
#             text = str(input("Type Yes to roll the dice \n"))
#             if (text == 'Yes'):
#                 self.rollDice()
#     def rollDice(self):
#         print('The dice rolled and you got {}'.format(self.roll))
#         exit()

# RollTheDice = Dice()
# RollTheDice.toRoll()

# class Canvas:
#     def __init__(self, width, height):
#         self.width = width
#         self.height = height
#         self.data = [[' '] * width for i in range(height)]

#     def setpixel(self, row, col):
#         self.data[row][col] = '*'

#     def getpixel(self, row, col):
#         return self.data[row][col]

#     def display(self):
#         print("\n".join(["".join(row) for row in self.data]))

# class Shape:
#     def paint(self, canvas): pass

# class Rectangle(Shape):
#     def __init__(self, x, y, w, h):
#         self.x = x
#         self.y = y
#         self.w = w
#         self.h = h

#     def hline(self, x, y, w):
#         pass

#     def vline(self, x, y, h):
#         pass

#     def paint(self, canvas):
#         hline(self.x, self.y, self.w)
#         hline(self.x, self.y + self.h, self.w)
#         vline(self.x, self.y, self.h)
#         vline(self.x + self.w, self.y, self.h)

# class Square(Rectangle):
#     def __init__(self, x, y, size):
#         Rectangle.__init__(self, x, y, size, size)

# class CompoundShape(Shape):
#     def __init__(self, shapes):
#         self.shapes = shapes

#     def paint(self, canvas):
#         for s in self.shapes:
#             s.paint(canvas)

# rec = Rectangle()
# print(rec)

# nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

# my_list = []
# for letter in 'abcd':
#     for num in range(4):
#         my_list.append((letter, num))
# print(my_list)

# my_list =[(letter, num) for letter in 'abcd' for num in range(4)]
# print(my_list)

# names = ['Bruce', 'Clark', 'Peter', 'Logan', 'Wade']
# heros = ['Batman', 'Superman', 'Spiderman', 'Wolverine', 'Deadpool']

# my_dict = {}
# for name, hero in zip(names, heros):
#     my_dict[name] = hero
# print(my_dict)

# my_dict = {name: hero for name, hero in zip(names, heros) if name != 'Peter'}
# print(my_dict)

# digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
# repeat_digits = [n for n in range(1, 1000001) for x in digits ]
# print(repeat_digits)

# people = [
#     {
#         'name': 'John Doe',
#         'age': 20,
#         'city': 'Gotham',
#         'state': 'NY'
#     },
#     {
#         'name': 'Jane Doe',
#         'age': 18,
#         'city': 'Kings Landing',
#         'state': 'NY'
#     },
#     {
#         'name': 'Corey Schafer',
#         'age': 25,
#         'city': 'Boulder',
#         'state': 'CO'
#     },
#     {
#         'name': 'Al Einstein',
#         'age': 17,
#         'city': 'Denver',
#         'state': 'CO'
#     },
#     {
#         'name': 'Jane Taylor',
#         'age': 38,
#         'city': 'Faketown',
#         'state': 'NC'
#     },
#     {
#         'name': 'John Henry',
#         'age': 17,
#         'city': 'Hinton',
#         'state': 'WV'
#     },
#     {
#         'name': 'Randy Moss',
#         'age': 22,
#         'city': 'Rand',
#         'state': 'WV'
#     },
#     {
#         'name': 'Nicole K',
#         'age': 17,
#         'city': 'Kings Landing',
#         'state': 'NC'
#     },
#     {
#         'name': 'Jim Doe',
#         'age': 19,
#         'city': 'Charlotte',
#         'state': 'NC'
#     },
# ]


# result = [n for n in people if n['name'].startswith('J')]
# print(result)

# numbers = [72, 26, 79, 70, 20, 68, 43, -71, 71, -2]
# print([x*2 if x%2 == 0 else -1*x for x in numbers])

# sentence = 'this_function_is_lit'
# result = [''.join(n.capitalize() for n in sentence.split('_'))]
# print(f'{result[0][0].lower()}{result[0][1:]}')

# names = ["Ryan", "Kieran", "Jason", "Yous"]
# result = 33 names])
# print(result)

# import re
# pattern = '^a...s$'
# test_string = 'gggg'
# result = re.match(pattern, test_string)
# if result:
#   print("Search successful.")
# else:
#   print("Search unsuccessful.")	

# import re
# string = 'hello 12 hi 89. Howdy 34'
# pattern = '\d+'
# result = re.findall(pattern, string) 
# print(result)

# import re
# # multiline string
# string = 'abc 12\
# de 23 \n f45 6'
# # matches all whitespace characters
# pattern = '\s+'
# # empty string
# rep = ''
# new_string = re.sub(pattern, rep, string) 
# print(new_string)

import random


"""
Learn how to read and write these structured data formats.
"""

readings = {
    "yaml": "https://yaml.readthedocs.io/en/latest/",
    "csv": "https://docs.python.org/3/library/csv.html",
    "pickle": "https://docs.python.org/3/library/pickle.html",
    "json": "https://docs.python.org/3/library/json.html",
    "html": "https://www.crummy.com/software/BeautifulSoup/bs4/doc/",
}

print(random.choice(list(readings.items())))