正在寻找有关python项目的帮助

正在寻找有关python项目的帮助,python,Python,你好,我是新来的编码,我正在尝试做一个项目,以帮助我学习的基本知识,并帮助我的女朋友与她的纹身定价任何帮助将不胜感激 def tattoo_pricing(total_price): `total = [] + 40 total_hours = input('how many hours roughly are you going to be tattooing?:') if total_hours[0] == 1: total += 60 eli

你好,我是新来的编码,我正在尝试做一个项目,以帮助我学习的基本知识,并帮助我的女朋友与她的纹身定价任何帮助将不胜感激

def tattoo_pricing(total_price):
    `total = [] + 40
    total_hours = input('how many hours roughly are you going to be tattooing?:')
    if total_hours[0] == 1:
        total += 60
    elif total_hours[0] == 2:
       total += 120`
我只想将总小时数乘以60,但不知道如何获取输入


任何帮助都将不胜感激:)对不起,我现在只上了几个月的课,但我觉得这已经接近我的技能水平了,我只是有很多困难,因为我自己只做了一个项目

不,
input
给了你一个字符串

比如说

>>> a = input()
12
a[0]
'1'
,而
a[1]
'2'

课程中的示例使用每个角色做其他事情。但在你的情况下,你只需要

total = int(input('how many hours roughly are you going to be tattooing?:')) * 60


如果我理解正确,数组中的第一项(如果从命令行运行,则参数0)是小时数?假设total_hours[0]是小时数,则可以执行以下操作

def tattoo_pricing(total_hours):
    total = 40
    total_hours = input('how many hours roughly are you going to be tattooing?:')
    total += 60 * int(total_hours[0])

这将使总数等于每小时60加上似乎是40的基线。

您似乎出于某些原因故意滥用
#
。这里不行,请停下来。你想知道我的问题格式是否正确。好的,谢谢。对不起,我是这个网站的新手,不知道帖子会是这样的。谢谢你的帮助help@Namastex3在你的代码中,
total_hours
是数组还是变量???我使用了课程中的示例,数组是我目前理解如何获取输入的唯一方法,但这可能不是我的本事。是的,这就是我想要的。非常感谢!没问题,很高兴我能帮忙。此外,如果这是你想要的,你可以标记为答案,让其他人知道你已经准备好了。
def tattoo_pricing(total_hours):
    total = 40
    total_hours = input('how many hours roughly are you going to be tattooing?:')
    total += 60 * int(total_hours[0])