暗記メーカー
ログイン
python 1
  • Chi Yu

  • 問題数 100 • 8/6/2024

    記憶度

    完璧

    15

    覚えた

    35

    うろ覚え

    0

    苦手

    0

    未解答

    0

    アカウント登録して、解答結果を保存しよう

    問題一覧

  • 1

    How to print the data type of x and y? x = 5 y = "John" print(x) print(y)

  • 2

    How can we find the length of the list? thislist = ["apple", "banana", "apple", "banana", "cherry"] print(thislist)

  • 3

    Write a for loop in Python to iteration the list below. When x = banana, dont print the upcoming fruits and banana fruits = ["apple", "banana", "cherry"]

  • 4

    is it legit? What is the output? How to fix or modify it? thislist = ["apple", "banana", "cherry"] print(thislist)

  • 5

    what should be added to this code in order to format the value of string with no decimal place? txt = "The price is {add things here} dollar" print(txt.format(25.22))

  • 6

    Which of them are legit? x = str("s1") y = str(2) z = str(3.0) k = str(3 + 1j)

  • 7

    How to convert an integer to float , float to integer, integer to complex number in python? - Is it possible to convert complex numbers into another number type?

  • 8

    How to unpack the list in the tuple into a variable called "list"? How to access to the 3 in the list which is an item of a tuple? mytup = (True, 'orange', [3,4])

  • 9

    what should be add to this code in order to format the value of string with percentage? txt = "You scored {add things here}" print(txt.format(0.25))

  • 10

    How to change the items of the list by the following requirements? thislist = ["apple", "banana", "cherry"] 1. change the banana into "watermelon" 2. change the banana into "watermelon" and add "mango" in the following with one line of code 3. change the banana into "watermelon" and erase the "cherry" with one line of code 4. add a "watermelon" into the list followed by the banana without replacement thislist = ["apple", "banana", "cherry", "orange", "kiwi", "mango"] 5. change the banana and cherry with "watermelon" and "mango" with one line of code

  • 11

    How to leave an empty for loop without error in python?

  • 12

    What are the results of each print()? What is "is" keyword used for? x = ["apple", "banana"] y = ["apple", "banana"] z = x print(x is z) print(x is y) print(x == y)

  • 13

    Are they the same? x = "John" x = 'John'

  • 14

    How to verify the type of object in python?

  • 15

    What is the output of this code? length = 5 width = 6 area = width*length/9 print(area)

  • 16

    Write a for loop in Python to iteration the list below. When x = banana, skip printing the banana and print the upcoming fruits fruits = ["apple", "banana", "cherry"]

  • 17

    What is iterator? Is iterator an Iterable object?

  • 18

    How to print items in the tuple as the following requirements? How will these statements return? thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango") 1. third, fourth, and fifth item 2. print from beginning until reaching to kiwi 3. print from cherry until the end 4. print from orange until melon using negative index

  • 19

    How can we specify a for loop to print from one number from 2 to 5 on each line in python?

  • 20

    How to find the number of elements stored in tuple?

  • 21

    Is it legit? How to fix it? x = y = "orange" print(x) print(y) print(z)

  • 22

    Which of them are legit? x = int(1) y = int(2.8) z = int("3") k = int("3.3")

  • 23

    What are the results of each print()? What is "in" keyword used for? x = ["apple", "banana"] print("banana" in x) name = "Joe" print(name in ["Joe", "John"])

  • 24

    Create a list with its constructor in python to contain string "apple", string "banana", and string "cherry"

  • 25

    Does Python have ++ and -- operators?

  • 26

    In python, what is the role of data types and variables respectively?

  • 27

    Is it legit? What is the outcome? How to fix or modify it? What is the purpose of using else? for x in range(6): if x == 3: break print(x) else: print("Finally finished!")

  • 28

    Is it legit? How to fix it? x,y,z = "orange", "apple" print(x) print(y)

  • 29

    How to ask the input from user? - What is the data type of the returning value? - How to convert the user input into int?

  • 30

    Can if statement use pass statement to skip its evaluation?

  • 31

    How can specify the first item in the list?

  • 32

    What parameters do the enumerate() function take in python?

  • 33

    Wirte an if else statement for a = 200 and b = 33 with conditions of a > b, a==b, and a<b in python

  • 34

    How to create constant in python? Does Python have built-in constant type?

  • 35

    What does this code mean? x = 15 y = 2 print(x // y)

  • 36

    Can while loop use else statement? What is the purpose of using it?

  • 37

    Is it legit to upack this list like this? Any other data structure can be unpacked like this? fruits = ["apple","banana","cherry"] x,y = fruits print(x) print(y)

  • 38

    If we zip two or more iterables in which one of the iterable has shorter length, what is the effect to the output after zipping these iterables together with zip()?

  • 39

    How to define integer, float, and complex number to x, y, and z respectively?

  • 40

    How to determine if "banana" is present in the tuple? Does the keyword find an equal value or equal object? thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")

  • 41

    How to iterate each value of the tuples after zipping with zip()? - first, create two tuples with the equal length - second, print out the each values stored in each tuple in the zipped object

  • 42

    Is there any limits in length and sign for integer in python?

  • 43

    Is it legit? How to fix or modify it? x = "awesome" def myfunc(x): global x = "fantastic" myfunc(x) print("Python is " + x)

  • 44

    Is it legit? What is the output? How to fix or modify it? x = "awesome" def myfunc(x): x = "fantastic" print("Python is " + x) myfunc(x) print("Python is " + x)

  • 45

    Do I need to declare variables as one of the data type before using them?

  • 46

    Is it legit in python? What is the output? x,y,z = 10, 2.5, "hello" print(x * z)

  • 47

    What parameters does the zip() fucntion take? - What data type? - How many can it take?

  • 48

    How can we specify a for loop to print from one number from 2 to 30 on each line in python, which the number is incremented by 2 each time?

  • 49

    What is packing a tuple and unpacking a tuple?

  • 50

    Can variable change their data type after they have been set?

  • 51

    Is it legit? How to fix it? x = 5 y = str(6) print(x + y)

  • 52

    What does this code mean? x = 2 y = 5 print(x ** y)

  • 53

    Write a short-handed if...else statement with 3 conditions of a > b, a = b, and a < b for a = 330, b =330

  • 54

    Write a for loop to iterate a string "banana" and print each letter on each line

  • 55

    How to make this code return true by adding appropriate keyword? What does this keyword mean? x = ["apple", "banana"] print("pineapple" ___ x)

  • 56

    Is it legit in python? What is the output? x = 35e3 print(type(x))

  • 57

    What is the output? thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango") print(thistuple[-1:-4])

  • 58

    Is python an object oriented programming language?

  • 59

    Which of them are legit? x = float(1) y = float(2.8) z = float("3") k = float("4.2")

  • 60

    Is it legit in python? What is the data type convertion of x after printed? x = 4 x = "John" print(x)

  • 61

    How can we modify, add, and delete the value of the tuple even it has been created? Write codes for those 3 actions - What data type can we cast when we nees to modify the items in tuple? x = ("apple", "banana", "cherry")

  • 62

    What are 3 features of a tuple have?

  • 63

    Is it legit in python? How to fix it? x y = "John" print(x) print(y)

  • 64

    What is the output of this code? for x in range(6): print(x)

  • 65

    How to expression and, or, not logic in x < 5, x < 10?

  • 66

    How can we delete an existing tuple at once? x = ("apple", "banana", "cherry")

  • 67

    How to iterate each element in the list and print out with its index and value on each line? a = ["Mary", "Has", "a", "little", "lamb"]

  • 68

    How can we add a new tuple with only one element inside to an existing tuple? -Do we need to cast for this? x = ("apple", "banana", "cherry")

  • 69

    What does the zip() function return in python? What is the result if one of the iterable is shorter?

  • 70

    Is it legit? What is the output? How can it be fixed or modified? thislist = ["apple", "banana", "apple", "banana", "cherry"] print(thislist)

  • 71

    Is it legit? How to fix or modify it? x = "awesome" def myfunc(x): print("Python is " + x) myfunc(x)

  • 72

    What are the 3 features of list in python?

  • 73

    What is the output? thislist = ["apple", 30, "apple", True, "cherry"] print(type(thislist))

  • 74

    Is it legit? What is the output? How to fix or modify it? tuple1 = ("abc", 34, True, 40, "male") print(tuple1)

  • 75

    cast x as a string, y as an integer, and z as a decimal number x = 3 y = 3 z = 3

  • 76

    Is it legit? How to fix it? x = 5 y = "John" print(x + y)

  • 77

    Will the c > d be evaluated when a > b is true? a = 5; b = 7 c = 8; d = 4 if a < b or c > d: print("print this")

  • 78

    How to create a tuple with only one element?

  • 79

    How to duplicate the items within the tuple? So that fruits = ("apple","banana", "cherry") makes ("apple","banana", "cherry", "apple","banana", "cherry")

  • 80

    Is it correct that once a list has been created, the data in the list cannot be added, removed, and changed?

  • 81

    Is it legit? What is the output? How can it be fixed or modified? thislist = ["apple", 30, "apple", True, "cherry"] print(thislist)

  • 82

    How to assign 10, 2.5, and "Hello" to x,y,z respectively in one line statement?

  • 83

    How to print the 2.5 and "hello" as string and separate them by a space without adding the space character? x,y,z = 10, 2.5, "hello"

  • 84

    How to unpack the following tuple by those requirements below? Must the number of variables for unpacking the tuple match the number of item in the tuple? fruits = ("apple", "banana", "cherry", "strawberry", "raspberry") 1. unpack each item into one variable 2. unpack apple into variable green, banana into variable yellow, and the rest of them into a list of variable red 3. unpack apple into variable fruit1, raspberry into variable fruit3, and the rest of them into variable fruit2

  • 85

    How to print the last item in the tuple with negative index? thistuple = ("apple", "banana", "cherry")

  • 86

    List out 2 ways that can create a tuple in python - simplest way - way with constructor

  • 87

    Create a list in python to contain string "apple", string "banana", and string "cherry"

  • 88

    What are the results of each print()? What is "is not" keyword used for? x = ["apple", "banana"] y = ["apple", "banana"] z = x print(x is not z) print(x is not y) print(x != y)

  • 89

    What is the result of this code? tup = tuple("hello") print(tup)

  • 90

    Rewrite the program in the Fundamental of ML lab 2. The program zip two lists into an zip object, and make the zip object as an enumerate object. After that, iterate the enumerate object and display each elements in the object with indices

  • 91

    What model does the python organize its objects?

  • 92

    Is it legit? How to fix it? What is its output? x = "Python" y = "is" z = "awesome" print(x + y, z)

  • 93

    What are the 4 types of built-in data type in python that store a collection of data?

  • 94

    Is it legit in python? How to fix it? int x = 5 y = "John" print(x) print(y)

  • 95

    what are 3 ways to use string format() method with placeholder in python? fname = "John" age=36

  • 96

    Is it legit in python? What is the output? x = 3 + 5j print(type(x))

  • 97

    List the 5 main types of the built-in data type in the python and list their child data type respectively