萝卜头IT论坛

搜索
查看: 1291|回复: 3
收起左侧

[水] 求解答几道python题目

[复制链接]
发表于 2020-12-31 18:36:29 | 显示全部楼层 |阅读模式
题目如下:
第一题:
程序运行时,首先屏幕显示“你是哪个学校的?”并等待输入,当通过键盘输入学校后,需要将输入的学校名称存储起来,然后屏幕显示“我就读于“,跟着显示刚才存储的内容。
第二题:
计算正方形面积。需要先知道正方形的边长,然后计算面积,最后输出。
第三题:
判断教室内是否可以开空调。首先需要知道教室内温度,高于32度可以开空调,否则就不能。
第四题:
判断成绩等级。85~100为优秀,75~84为良好,60~74为合格,60以下为不合格。





求解答,万分感谢
回复

使用道具 举报

发表于 2020-12-31 20:56:48 | 显示全部楼层



  1. def test1():
  2.     addr = input('哪儿来的小逼崽子?')
  3.     print('贫僧来自'+addr)

  4. def test2():
  5.     x = float(input(''))
  6.     print(x**2)

  7. def test3():
  8.     temp = float(input(''))
  9.     if temp > 32: print('YES')
  10.     else : print('NO')

  11. def test4():
  12.     score = int(input(''))
  13.     level = ['优秀', '良好', '合格', '不合格']
  14.     you = 3
  15.     if score >= 60: you -= 1
  16.     if score >= 75: you -= 1
  17.     if score >= 85: you -= 1
  18.     print(level[you])

  19. print('test1() ')
  20. test1()
  21. print('test2() ')
  22. test2()
  23. print('test3() ')
  24. test3()
  25. print('test4() ')
  26. test4()
复制代码


回复

使用道具 举报

发表于 2021-1-1 01:37:12 来自手机 | 显示全部楼层
  .
-59a33f45191861d7.jpg
回复

使用道具 举报

发表于 2021-2-5 10:29:14 | 显示全部楼层
print("你那个学校的")
school = input()
print("我就读"+school)
回复

使用道具 举报

联系我们(Contact)|手机版|萝卜头IT论坛 ( 苏ICP备15050961号-1 )

GMT+8, 2024-4-26 18:15 , Processed in 0.101743 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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