Conditionals Warm Up#

Section Title: Conditionals Warm Up

Warm Up Question-1#

Convert the variable \(x = 2\) to a string, assign it to the variable \(y\), and then display the type of \(y\).

Warm Up Question-2#

Determine the output of the code below

print(5 > 3)
print(10 > 20)

Warm Up Question-3#

Determine the output of the code below

x = 5

if x > 3:
    print('A')

Warm Up Question-4#

Determine the output of the code below

x = 5
if x < 3:
    print('A')

Warm Up Question-5#

Determine the output of the code below

if 1 > 4:
    print('A')
else:
    print('B')

Warm Up Question-6#

Write a program that displays hot if the variable temperature is greater than 80; otherwise, it should display not hot.

  • Test your code using temperature values of 100 and 50.

Warm Up Question-7#

Determine the output of the code below

if 6 > 4:
    print('A')
    if 7 < 5:
        print('B')
    else:
        print('C')

Warm Up Question-8#

Write a program that prompts the user to enter a name and returns the 5th character.

  • Use a try-except statement to warn the user if the name contains fewer than 5 characters.