鱼C论坛

 找回密码
 立即注册
查看: 2095|回复: 3

[已解决]零基础入门phthon 002课,为什么程序运行不了?

[复制链接]
发表于 2020-3-12 16:14:53 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
本帖最后由 一个账号 于 2020-3-12 16:41 编辑
  1. print('------------我爱鱼C工作室---------------')
  2. temp = input("不妨猜一下小甲鱼现在心里想的是哪个数字:")
  3. guess = int(temp)
  4. if guess == 8:
  5.     print("我草,你是小甲鱼心里的蛔虫吗!?")
  6.     print("哼,猜中了也没有奖励!")
  7. else:
  8.     print("猜错啦,小甲鱼现在心里想的是8!")
  9. print("游戏结束,不玩啦^-^")
复制代码



运行以后显示
IDLE's subprocess didn't make connection.
See the 'Startup failure'section of the IDLE doc,online at
https://docs.python.org/3/library/idle.html#startup-failure
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2020-3-12 16:41:58 | 显示全部楼层
错误原因分析:

同层目录下存在和Python库文件相同名字的.py文件,导致子进程无法创建的问题。

解决方法:

排查目录下的.py文件,找到和库文件名字相同的.py文件,然后重命名之。
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-3-12 16:45:44 | 显示全部楼层    本楼为最佳答案   
参考:https://www.cnblogs.com/skyhiter/p/3381385.html
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-3-13 08:39:26 | 显示全部楼层
  1. import random

  2. counts = 4
  3. answer = random.randint(1,10)

  4. while counts > 0:
  5.     temp = input("猜猜我心里想的是哪个数字?(只有四次机会哦)")
  6.     guess = int(temp)

  7.     if guess == answer:
  8.         print("竟然猜对了…………")
  9.         print("既然猜对了,那么给你个奖励:对着镜子石头剪刀布,没赢不许睡觉")
  10.         break

  11.     else:
  12.         if guess < answer:
  13.             print("小了哦~")
  14.         else:
  15.             print("大了哦~ ")
  16.     counts = counts-1
  17. temp = input("按0进入下一轮")
  18. guess = int(temp)


  19. import random

  20. counts = 4
  21. answer= random.randint(1, 10)

  22. while counts > 0:
  23.     temp = input("猜猜我心里想的是哪个数字?(只有4次机会哦)")
  24.     guess = int(temp)

  25.     if guess == answer:
  26.         print(" 怎……么……又……猜……对……了……")
  27.         print("猜对奖励:背诵弟子规10000遍")
  28.         break

  29.     else:
  30.         if guess < answer:
  31.             print("小啦~")
  32.         else:
  33.             print("大啦~")
  34.     counts = counts - 1
  35. temp = input("按0进入下一轮")
  36. guess = int(temp)

  37. import random

  38. counts = 4
  39. answer= random.randint(1, 10)

  40. while counts > 0:
  41.     temp = input("猜猜我心里想的是哪个数字?(只有4次机会哦)")
  42.     guess = int(temp)

  43.     if guess == answer:
  44.         print(" 这,这,竟然然猜对了!")
  45.         print("猜对奖励:给自己来一拳")
  46.         break

  47.     else:
  48.         if guess < answer:
  49.             print("小啦~")
  50.         else:
  51.             print("大啦~")
  52.     counts = counts - 1
  53. temp = input("按0进入下一轮")
  54. guess = int(temp)


  55. import random

  56. counts = 4
  57. answer= random.randint(1, 10)

  58. while counts > 0:
  59.     temp = input("猜猜我心里想的是哪个数字?(只有4次机会哦)")
  60.     guess = int(temp)

  61.     if guess == answer:
  62.         print(" 啥?!你居然又双叒叕猜对了!")
  63.         print("猜对奖励:给自己一个最爱吃的耳光")
  64.         break

  65.     else:
  66.         if guess < answer:
  67.             print("小啦~")
  68.         else:
  69.             print("大啦~")
  70.     counts = counts - 1
  71. temp = input("按0进入下一轮")
  72. guess = int(temp)



  73. import random

  74. counts = 4
  75. answer= random.randint(1, 10)


  76. while counts > 0:
  77.     temp = input("再猜猜我心里想的是哪个数字?(只有4次机会哦)")
  78.     guess = int(temp)

  79.     if guess == answer:
  80.         print(" 哼!居然又猜对了!")
  81.         print("哼,不玩了,掰掰")
  82.         break

  83.     else:
  84.         if guess < answer:
  85.             print("小啦~")
  86.         else:
  87.             print("大啦~")
  88.     counts = counts - 1


  89. temp = input("按7退出")
  90. guess = int(temp)

  91. if guess == 7:
  92.     print("掰掰")
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-5-14 08:36

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表