python 3 input code example

Example 1: python input

#Collecting The Input As A Variable:#
name = input('Please enter your name: ')
#Printing The Variable:#
print(name)
#Checking The Variable And Printing Accordingly:#
if name == 'Joe':
  print('Joe Mama')

Example 2: input python 3

answer = input("What is your name? ")
print(f"Your name is {answer}")

Example 3: input python

# Input statements are used to ask questions to the user

text = input("Enter your name: ")

# printing the variabale 
print(text)

Example 4: python3 any

# True since 1,3 and 4 (at least one) is true
l = [1, 3, 4, 0]
print(any(l))

# False since both are False
l = [0, False]
print(any(l))

# True since 5 is true
l = [0, False, 5]
print(any(l))

# False since iterable is empty
l = []
print(any(l))