Python-Quiz One (mooc)

1.Guido van Rossum officially released version of Python year is:
2008
2002
1991
1998
the correct answer C
Python successful, so the development of the history of the early years has also been concern following the initiation of the schedule Guido readme:

"
December, 1989 Implementation started
1990 Internal releases at CWI
February 20, 1991 0.9.0 (released to alt.sources)
February, 1991 0.9.1
In view of the fact that Internal release is not an external release, it is generally believed that the Python language was born in 1991.

2
The following Python languages About "indent" statement is correct:
4 spaces to indent unified
indentation is not mandatory, only to increase the readability of the code
indentation in the program mandatory use of uniform length and
indentation can be used after any statement, Indicate the inclusion relationship between statements. The
correct answer C
Python language indentation only needs to be unified, not necessarily 4 spaces (although this is a convention).

3
The following does not belong to the IPO model is:
Process
the Output
the Input
Program
correct answer is D
the IPO: the Input the Output Process

4
A character string is a sequence of characters. For the character string s, the following means that the third character of s from right to left is: S [0: -3] S [. 3]
S [:
-. 3]
S
[-3]
correct answer D
characters The string has two sets of serial number system: positive increasing and negative decreasing

5
The following is not legal Python language is named:
MyGod
MyGod
5MyGod
MyGod5
correct answer C
legitimate named first character can not be a number.

6
in Python, the function is configured to obtain user input: eval
()
the iNPUT ()
Print ()
gET ()
the correct answer B
gET () is not a Python built-in functions, only one way to get user input: input ().

7
The following does not belong Python reserved words are:
of the type
elif
DEF
Import
correct answer A
of the type is not a Python reserved word, but the built-in function type ().

8
The following is not a Python data types are:
integer
string
of real numbers
list
the correct answer C
real concept in mathematics, corresponds to float in Python.

9
Which option does the reserved word not directly represent the branch structure?
elif
in
the else
IF
The correct answer B
if-elif-else is a branch expression, in is used to judge members.

10
Use print () to format the output. Which option is used to control the output of two digits after the decimal point of a floating point number?
{.2f}
{: .2f}
{.2}
{: .2} The
correct answer B
: .2f no one can be less

Numerical calculation
is described
to obtain a character string inputted by the user, the following format: ‪‬‪‬‮‬‪‬‭‬

M OP N

Among them, M and N are any numbers, OP represents an operation, expressed as the following four: +,-, *, / (addition, subtraction, multiplication and division) ‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪ ‬‪‬‪‬‪‬‮‬‫‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‭‬

According to OP, the operation result of M OP N is output, and the two decimal places are saved uniformly.

Note: There can be multiple spaces between M and OP, OP and N, regardless of input errors.

a=input("")
b=eval(a)
print("{:.2f}".format(b))

Conditional output of Hello World
Description
Obtain an integer entered by the user, refer to the integer value, and print out "Hello World", request: ‬‮‬‫‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‭‬

If the input value is 0, direct output "Hello World" ‪‬‮‬‪‬‭‬

If the input value is greater than 0, output "Hello World" (space is also a character) with two characters ‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‬‪‬‬‬ ‭‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‭‬

If the input value is less than 0, output "Hello World" vertically

n = eval(input())
if n == 0:
    print("Hello World")
elif n > 0:
    print("He\nll\no \nWo\nrl\nd")
else:
    for c in "Hello World":
        print(c)```



```cpp
a=input()
a=int(a)
if a==0:
    print("Hello World")
elif a>0:
    print("He")
    print("ll")
    print("o ")
    print("Wo")
    print("rl")
    print("d")
elif a<0:
    print("H\ne\nl\nl\no\n \nW\no\nr\nl\nd")```
    
Published 29 original articles · praised 0 · visits 481

Guess you like

Origin blog.csdn.net/qq_43771959/article/details/105568296