Study

python data type

  •   0%
  •  0     0     0

  • How do we convert input to a whole number?
    int()
  • What does float() do?
    Converts to a decimal number
  • Why do we use type conversion?
    To calculate with numbers
  • What data type does input() always return?
    String
  • Which function shows output?
    print()
  • Write one line that asks for age and prints age + 1
    age = int(input("Enter age: ")) / print(age + 1)
  • What is wrong with this code? x = input("Enter: ") / print(x + 5)
    x is a string
  • What will be the output if the user enters 10? age = int(input("Enter your age") / print(age + 5)
    15
  • write a line correctly that takes a number as input?
    num = int(input("Enter a number: "))
  • What will be the output if x="3" ? / print( x * 2)
    33
  • True or False: input() returns an integer .. and why?
    False .. it returns string