Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Futures
- import keyboard
- from tkinter import *
- # [...]
- def ageCheck():
- birthYear = int(input('Your birth year: '))
- age = 2020 - birthYear
- print("You are %d years old" % (age))
- # This program takes the user's birth year as an integral input and stores it as a variable.
- # It then subtracts birthYear from 2020 and then prints it out in a statement.
- def downwardCount():
- n = 5
- try:
- while True:
- print(n)
- n = n - 10
- except KeyboardInterrupt:
- pass
- def deskLength():
- while True:
- try:
- lengthInInches = int(input("Length of the desk in inches: "))
- except ValueError:
- print("Please print an integer.")
- continue
- else:
- return lengthInInches
- break
- #deskLength needs to be rewritten to fix try and except stuff.
- lengthInCM = lengthInInches * 2.54
- print("The desk is %d centimetres long" % (lengthInCM))
- def goodDay():
- x = 1
- while x <= 6:
- print("Have a good day")
- x += 1
- def ticketPrice():
- age = int(input("Your age: "))
- if age < 14:
- print("You are a child and must pay $5.00.")
- elif age > 65:
- print("You are a senior and must pay $7.00.")
- else:
- print("You are an adult and must pay $9.00.")
- def passOrFail():
- grade = int(input("Your class mark: "))
- if grade >= 50:
- print("You passed the course")
- if grade < 50:
- print("You failed the course")
- def speedCheck():
- hours = int(input("Number of hours in trip: "))
- minutes = int(input("Number of additional minutes in trip: "))
- distance = int(input("Distance of trip in kilometers: "))
- speed = distance / (hours * 60 + minutes)
- print("You are driving at %d km/h." % (speed))
- def wordCounter():
- wordList = []
- word = str(input("Enter your word: "))
- while word != "exit":
- wordList.append(word)
- word = str(input("Enter your word: "))
- wordCount = len(wordList)
- print("You inputted %d words" % (wordCount))
- exit()
- def integerSizing():
- positiveIntegers = []
- while len(positiveIntegers) < 10:
- integer = int(input("Enter Positive Integer: "))
- if integer < 1:
- print("Integer must be positive")
- continue
- positiveIntegers.append(integer)
- positiveIntegers.sort()
- largest = positiveIntegers[-1]
- print("The largest number is %d" % largest)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement