我正在自学如何编写代码,目前正在做一个掷骰子的学习项目。目前我遇到了一个奇怪的问题。我的代码中的第四个"def",不管它实际上是什么(我尝试了几个单独工作的),它总是被标记为语法错误。以下是我所拥有的:import random

def mult():

print("How many dice would you like to roll?")

multiplier = input()

mod()

def mod():

print("What modifier, if any, would you like to assign?")

modifier = input()

result()

def result():

total = (roll * multiplier) + modifier

print("Your result is"

(str(total)

def menuscreen():

print("Welcome to Jack"s dice roller. What kind of die would you like to roll?")

print("")

print("A. d2")

print("B. d4")

print("C. d6")

print("D. d8")

print("E. d10")

print("F. d12")

print("G. d20")

print("H. d100")

def gen():

menuscreen()

if input() == "a" or "A":

roll = random.randint(1,2)

mult()

if input() == "b" or "B":

roll = random.randint(1,4)

mult()

if input() == "c" or "C":

roll = random.randint(1,6)

mult()

if input() == "d" or "D":

roll = random.randint(1,8)

mult()

if input() == "e" or "E":

roll = random.randint(1,10)

mult()

if input() == "f" or "F":

roll = random.randint(1,12)

mult()

if input() == "g" or "G":

roll = random.randint(1,20)

mult()

if input() == "h" or "H":

roll = random.randint(1,100)

mult()

def queryque():

print("Would you care to roll again?")

if input == "yes":

gen()

if input == "no":

end

gen()

python3中def的用法-python3中的def函数语法错误相关推荐

  1. mysql中去重的用法_mysql中去重 distinct 用法

    在使用MySQL时,有时需要查询出某个字段不重复的记录,这时可以使用mysql提供的distinct这个关键字来过滤重复的记录,但是实际中我们往往用distinct来返回不重复字段的条数(count( ...

  2. python3语法错误-python3中的def函数语法错误

    我正在自学如何编写代码,目前正在做一个掷骰子的学习项目.目前我遇到了一个奇怪的问题.我的代码中的第四个'def',不管它实际上是什么(我尝试了几个单独工作的),它总是被标记为语法错误.以下是我所拥有的 ...

  3. python3中map的用法_python3中map()函数用法

    1.map语法: map() 函数语法:map(function, iterable, -) 简单来说,map()它接收一个函数 f 和一个 可迭代对象(这里理解成 list),并通过把函数 f 依次 ...

  4. python中print的用法_Python中print函数简单使用总结

    Python中print函数简单使用总结 print函数是Python的入门,每一个学习python的人都绕不开这个函数,下面介绍一下这个函数的用法. 打开电脑,选择python软件,下面选择pyth ...

  5. python中lambda()的用法_python中lambda()的用法

    在C++11和C#中都有匿名函数的存在.下面看看在python中匿名函数的使用. 1.lambda只是一个表达式,函数体比def简单很多. 2.lambda的主体是一个表达式,而不是一个代码块.仅仅能 ...

  6. python中all的用法_python中all用法

    广告关闭 腾讯云11.11云上盛惠 ,精选热门产品助力上云,云服务器首年88元起,买的越多返的越多,最高返5000元! 开发准备cas 的 python sdk 包含了用于访问和操作 cas 的所有 ...

  7. python中random模块用法_Python中random模块用法实例分析

    本文实例讲述了Python中random模块用法.分享给大家供大家参考.具体如下: import random x = random.randint(1,4); y = random.choice([ ...

  8. mysql中正则表达式的用法_Mysql中正则表达式Regexp常见用法

    Mysql中Regexp常见用法 模糊匹配,包含特定字符串 # 查找content字段中包含"车友俱乐部"的记录 select * from club_content where ...

  9. linux中ftp的用法,linux中的ftp命令用法(7页)-原创力文档

    第 第 PAGE 1 页 共 NUMPAGES 1 页 linux中的ftp命令用法 Linux系统中的ftp命令功能强大,那么它的具体用法是怎样呢?下面由小编为大家整理了linux中的ftp命令用法 ...

  10. python中path的用法,python中path的用法

    如何将python的路径加到path中 方法一:函数添加 1 import sys 2 查看sys.path 3 添加sys.path.append("c:\\") 方法二:修改环 ...

最新文章

  1. 【Linux学习九】负载均衡
  2. elementui的el-tree第一次加载无法展开和选中的问题
  3. 剑指offerpython_剑指offer系列python实现 日更(一)
  4. node n 切换node版本失败_node版本如何升级
  5. 数据库日常总结(笛卡儿积与笛卡儿集 )
  6. 【PP生产订单】收货Goods Receipt
  7. 478. Generate Random Point in a Circle | 478. 在圆内随机生成点(Java)
  8. 9,线程池 threadPool 与 线程池执行器 threadPoolExecutor
  9. [Unity] 战斗系统学习 4:FlowCanvas 中的 LatentActionNode
  10. win10电脑突然开不了热点,怎么办
  11. 【详细】小程序模板使用教程
  12. python安装旧版本、python历史版本下载
  13. 插值算法(数学建模学习)
  14. 数据库课程大作业——数据分析与数据管理系统实践
  15. Unity实现圆形旋转滚动视图
  16. Android利用zxing生成二维码,识别二维码,中间填充图片超详细、超简易教程
  17. python随机森林变量重要性_python机器学习之随机森林(七)
  18. 一、pyside6 安装
  19. nyoj 3 多边形重心问题
  20. 三星电视服务器正在维护0-1,三星液晶电视维修常见故障及排查

热门文章

  1. 9.Memcached 介绍
  2. 10. jQuery Callback 函数
  3. Spring源码窥探之:@Value
  4. Webpack框架知识整理——Modules
  5. 如何面试前端工程师?
  6. CSS3渐变(Gradients)-线性渐变
  7. EJB JBOSS的安装
  8. 3个开源TTS(四)eSpeak1.06的源码调试环境vim+vimgdb
  9. 介绍一个基于SpringBoot2的脚手架项目
  10. html画圣诞树—动态效果展示【炫酷合集 免费获取源码】