python高级练习题库实验2(A)部分

发布时间:2024年01月17日


题目1

编写一个程序,根据用户输入显示课程信息。程序应显示收据,如下例所示。
输入:
u
输出:
Which degree do you choose? Undergraduate (U) or Postgraduate §: U

Course summary:
Location: Wollongong, Liverpool
Duration: 3 years full-time or part-time equivalent

输入:
P
C
Which degree do you choose? Undergraduate (U) or Postgraduate §: P
Which course do you choose? Master by Coursework ? or Master by Research ?: C

Course summary:
Location: Wollongong, Liverpool
Duration: 1.5-2 years full-time or part-time equivalent

输入:
P
R
输出:
Which degree do you choose? Undergraduate (U) or Postgraduate §: P
Which course do you choose? Master by Coursework ? or Master by Research ?: R

Course summary:
Location: Wollongong
Duration: 2 years full-time or part-time equivalent

代码

d = input("Which degree do you choose? Undergraduate (U) or Postgraduate (P): ")
course = ""
if d == "P" :
    course = input("Which course do you choose? Master by Coursework (C) or Master by Research (R): ")
文章来源:https://blog.csdn.net/qq_43499381/article/details/135652208
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。