Choose the code to assign your age into age variable?age=45print(age)age="45 "print(age)age=str(99)print(age)None of the above
Question
Choose the code to assign your age into age variable?age=45print(age)age="45 "print(age)age=str(99)print(age)None of the above
Solution
The correct code to assign your age into the age variable would be:
age = 45 print(age)
This is because in Python, you assign values to variables by using the equals sign (=). The variable name goes on the left, the value you want to assign to the variable goes on the right. In this case, the variable name is "age" and the value is 45. The print function is then used to output the value of the variable.
Similar Questions
7.Question 7Consider this code:12age1 = input("How old are you? ")age2 = input("How old is your best friend? ")The user enters the ages in years as whole numbers (e.g., 2). Select the code fragment(s) that print the sum of the ages. Be sure to use Python 3.1 pointprint(int(age1) + int(age2))print(int(age1) + int(age2))print(age1 + age2)print(age1 + age2)print(str(int(age1 + age2)))print(str(int(age1 + age2)))x = int(age1)x = int(age1)y = int(age2)y = int(age2)print(str(x + y))print(str(x + y))
Complete the main method in the AgeChecker class by Declaring and instantiating a Scanner objectPrint the "What is your age?" message to the consoleDeclaring the int age variable, assigning it the output of nextInt()If the value of age is greater than 40 then print "You are old". Otherwise, print "You are young"
Write the output of the program below. age = 45if (age >= 35): {print ("I am Qualified")}
This script checks whether a person is eligible for voting or not. Which variable is most appropriate for line 2?1 age=int(input("Enter your age"))2 if ___ >=18:3 print("_____ for voting")4 ____:5 print("not eligible for voting")agevotenameprint
You are creating an application to display the user’s age at some time in the future. You begin typing your code:When you run the script, you get an error:You begin correcting your code:What should you type in the blank space? (Please type the value only ONCE as an answer. Please type your answer all in lower case. Example: word)1 point
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.