Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TEXTS = {
- '1': '''Situated about 10 miles west of Kemmerer,
- Fossil Butte is a ruggedly impressive
- topographic feature that rises sharply
- some 1000 feet above Twin Creek Valley
- to an elevation of more than 7500 feet
- above sea level. The butte is located just
- north of US 30N and the Union Pacific Railroad,
- which traverse the valley. ''',
- '2': '''At the base of Fossil Butte are the bright
- red, purple, yellow and gray beds of the Wasatch
- Formation. Eroded portions of these horizontal
- beds slope gradually upward from the valley floor
- and steepen abruptly. Overlying them and extending
- to the top of the butte are the much steeper
- buff-to-white beds of the Green River Formation,
- which are about 300 feet thick.''',
- '3': '''The monument contains 8198 acres and protects
- a portion of the largest deposit of freshwater fish
- fossils in the world. The richest fossil fish deposits
- are found in multiple limestone layers, which lie some
- 100 feet below the top of the butte. The fossils
- represent several varieties of perch, as well as
- other freshwater genera and herring similar to those
- in modern oceans. Other fish such as paddlefish,
- garpike and stingray are also present.'''
- }
- # registered users
- users = {
- "bob": "123",
- "ann": "pass123",
- "mike": "password123",
- "liz": "pass123"}
- # login
- print("-" * 40)
- print("Welcome to the app. Please log in: ")
- user_name = input("USERNAME: ")
- user_password = input("PASSWORD: ")
- istit = 0
- isnum = 0
- isupp = 0
- islow = 0
- numval = [] #číselné hodnoty v textu, slouží pro součet čísel v textu
- list_of_word_len = [] #list délky slov, slouží pro sestavení grafu
- # ověření uživatele
- if users.get(user_name) != user_password:
- print("Wrong user name or password.")
- elif users.get(user_name) == user_password:
- #výběr textu
- print("-" * 40)
- print("We have 3 texts to be analyzed.")
- user_select = input("Enter a number btw. 1 and 3 to select: ")
- print("-" * 40)
- #převedení textu
- short_us = TEXTS.get(user_select)
- no_dot = short_us.replace("." , "")
- no_comma = no_dot.replace("," , "")
- sele = no_comma.split()
- words_in_text = len(sele)
- x = 0
- while x < words_in_text:
- if sele[x].istitle():
- istit += 1
- if sele[x].isnumeric():
- numval.append(int(sele[x]))
- isnum += 1
- if sele[x].isupper():
- isupp += 1
- if sele[x].islower():
- islow += 1
- list_of_word_len.append(len(sele[x]))
- x += 1
- print("There are " + str(words_in_text) + " words in total.")
- print("There are " + str(istit) + " titlecase words.")
- print("There are " + str(isupp) + " uppercase words.")
- print("There are " + str(islow) + " lowercase words.")
- print("There are " + str(isnum) + " numeric strings.")
- print("-" * 40)
- val_in_set = set(list_of_word_len)
- while len(val_in_set) > 0:
- size = val_in_set.pop()
- print(size , "*" * list_of_word_len.count(size) , list_of_word_len.count(size))
- print("-" * 40)
- print("If we summed all the numbers in this text we would get: " + str(sum(numval)))
- print("-" * 40)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement