-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaskuser.py
More file actions
51 lines (31 loc) · 1.32 KB
/
askuser.py
File metadata and controls
51 lines (31 loc) · 1.32 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
This file is designed get the new user's input data, process that input in a similar fashion to
"""
# DEPENDENCIES
import pandas as pd
import numpy as np
# IMPORT THE MODEL
# IMPORT THE MAPPER
from pull import sr_map
# GLOBAL VARIABLES
# DEFINE FUNCTIONS
# Ask the user's input
def getSubreddits():
"""This function will iterate through requesting 5 Subreddits from the user,
and running data validation on each"""
print("We will be asking you for 5 Subreddits that interest you")
preferred_subreddits = [] # create an empty list
while len(preferred_subreddits) < 5: # while we have less than 5 subreddits entered, keep running
sr1 = input("Please enter a Subreddit you enjoy\n").lower().strip() #
if sr1 in sr_map.values() and sr1 not in preferred_subreddits: # mapper was already lowered
preferred_subreddits.append(sr1)
# try:
# if sr1 in inv_dict_sub.values():
# except:
# Print("I'm sorry, I don't recognize that Subreddit. Please try again.")
# preferred_subreddits.append(sr1)
print(f"You have entered {len(preferred_subreddits)} of 5")
return preferred_subreddits
new_user = getSubreddits()
print(new_user)
# pass the user's input through the same data "processing" that the model's data was done