Help please, why doesn't it show the next input?
William Bryant
gogobebe2 at gmail.com
Thu Sep 12 02:04:41 EDT 2013
Thanks everyone for helping but I did listen to you :3 Sorry. This is my code, it works, I know it's not the best way to do it and it's the long way round but it is one of my first programs ever and I'm happy with it:
'''#*************************************************************************'''
#* Name: Mode-Median-Mean Calculator *#
#* *#
#* Purpose: To calculate the mode, median and mean of a list of numbers *#
#* and the mode of a list of strings because that is what we are *#
#* learning in math atm in school :P *#
#* *#
#* Author: William Bryant *#
#* *#
#* Created: 11/09/2013 *#
#* *#
#* Copyright: (c) William 2013 *#
#* *#
#* Licence: IDK :3 *#
'''**************************************************************************'''
#-----# ~~Import things I am using~~ #-----#
# |
# |
# \/
import time
import itertools
#-----# ~~Variables that I am using, including the list.~~ #-----#
# |
# |
# \/
num_or_string = None
amount_numbers = []
List = []
prompt = "Does your list contain, a number or a string? \nEnter: "
user_inputHMNn = None
user_inputHMNs = None
#-----# ~~Functions that I am using.~~ #-----#
# |
# |
# \/
user_inputNOS = input(prompt)
user_inputNOS
time.sleep(1.5)
def NOS():
if user_inputNOS == "String" or user_inputNOS == "string" or user_inputNOS == "STRING" or user_inputNOS == "s" or user_inputNOS == "S" or user_inputNOS == "str":
HMNs()
elif user_inputNOS == "Number" or user_inputNOS == "number" or user_inputNOS == "NUMBER" or user_inputNOS == "N" or user_inputNOS == "N" or user_inputNOS == "int" or user_inputNOS == "num":
HMNn()
else:
global user_inputNOS2
global prompt
prompt = "You did not enter a valid field, :P Sorry. \nEnter: "
user_inputNOS2 = input(prompt)
user_inputNOS2
time.sleep(1.5)
NOS2()
def NOS2():
if user_inputNOS2 == "String" or user_inputNOS2 == "string" or user_inputNOS2 == "STRING" or user_inputNOS2 == "s" or user_inputNOS2 == "S" or user_inputNOS2 == "str":
HMNs()
elif user_inputNOS2 == "Number" or user_inputNOS2 == "number" or user_inputNOS2 == "NUMBER" or user_inputNOS2 == "N" or user_inputNOS2 == "N" or user_inputNOS2 == "int" or user_inputNOS2 == "num":
HMNn()
else:
global prompt
prompt = "You did not enter a valid field, :P Sorry. \nEnter: "
user_inputNOS2
time.sleep(1.5)
NOS2()
def HMNs():
global TheStr, user_inputHMNs, List_input
user_inputHMNs = input("You picked string. This program cannot calculate the mean or median, but it can calculate the mode. :D How many strings are you using in your list? (Can not be a decimal number) \nEnter: ")
user_inputHMNs
time.sleep(1.5)
TheStr = int(user_inputHMNs)
for i in range(TheStr):
List_input = input("Enter your strings. (One in each input field): ")
List.append(List_input)
print("Your list -> ", List)
def HMNn():
global TheNum, user_inputHMNn, List_input
user_inputHMNn = input("You picked number. :D How many numbers are you using in your list? (Can not be a decimal number) \nEnter: ")
user_inputHMNn
time.sleep(1.5)
TheNum = int(user_inputHMNn)
for i in range(TheNum):
List_input = input("Enter your numbers. (One in each input field): ")
List.append(List_input)
print("Your list -> ", List)
#-----# ~~The functions which need calling~~ #-----#
# |
# |
# \/
NOS()
Not done. I'll finish it today! :) Oh and thanks so much for helping, you guys are really nice :D Thanks a lot.
More information about the Python-list
mailing list