Я хочу jobber()
сделать следующее: если пользователь вводит «talk», он запускает chat()
и «calc» для calculator()
.Python Если оператор равен строке
Это мой первый проект, и я совершенно новый, поэтому спасибо за любую помощь.
import sys
import time
def chat():
print('Hello there. What is your name?')
name = sys.stdin.readline()
print('Your name is %s...interesting. My name is Chat I was created to have a small planned out conversation when you call me :)' % (name))
time.sleep(2)
print('How is the weather in your town today?')
weather = sys.stdin.readline()
time.sleep(1.5)
print('Your weather is %s? The weather in my town is quite sunny.' % (weather))
time.sleep(2)
print('This is all the conversation I can make at the moment. Please be patient while my creator trys to update me.')
def calculator():
print('How much money do you have?')
money = int(sys.stdin.readline())
print('How much are you paid?')
job = int(sys.stdin.readline())
print('How much do you usually spend?')
spent = int(sys.stdin.readline())
for week in range(0,30):
money = money + job - spent
print('Week %s. Money %s' % (week,money))
def jobber():
print('Type talk for a short chat. Type calc for a money calculator.')
choice = int(sys.stdin.readline())
if choice == 1:
chat()
if choice == 2:
calculator()
В чем проблема, что не работает? какая помощь вам нужна? – Zielu
Итак, где вы когда-нибудь называли 'jobber'? –