Commands Flashcards
print (“Welcome”)
displays the words “Welcome” to the screen
input (“Enter your name”)
asks the user to enter their name
int(input(“Enter a whole number”))
displays “Enter a whole number” and changes the data type of the input to an integer
number=int(input(“Enter a whole number”))
displays “Enter a whole number” and changes the data type of the input to an integer and saves the answer as variable number
If colour==blue:print(“blue)
checks if the colour is blue and prints blue if so
If num>5:print(5)
checks if number is larger than 5 and prints 5 if so
capital=input(“What is the capital of Bangladesh”)
displays “What is the capital of Bangladesh” and gets user to answer
if capital == “Dhaka”:
print(“Correct”)
else:
print(“wrong”)
If user inputs “Dhaka” then displays “Correct” otherwise displays “wrong)