SNHU IT 145 - zyBooks Ch 1, Part 1

Поділитися
Вставка
  • Опубліковано 26 сер 2024

КОМЕНТАРІ • 1

  • @djratio9889
    @djratio9889 Місяць тому

    # Prompt the user to input an integer between 32 and 126
    integer_input = int(input("Enter integer (32 - 126):
    "))
    # Prompt the user to input a float
    float_input = float(input("Enter float:
    "))
    # Prompt the user to input a character
    char_input = input("Enter character:
    ")
    # Prompt the user to input a string
    string_input = input("Enter string:
    ")
    # Output the four values on a single line separated by a space
    print(f"{integer_input} {float_input} {char_input} {string_input}")
    # Output the four values in reverse order
    print(f"{string_input} {char_input} {float_input} {integer_input}")
    # Convert the integer to a character using the chr() function
    converted_char = chr(integer_input)
    # Output the converted character
    print(f"{integer_input} converted to a character is {converted_char}")