TORONTO KIDS COMPUTER CLUB | TCMS 18:30 Python Homework 10.25
post-template-default,single,single-post,postid-16649,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.8.0,vc_responsive

TCMS 18:30 Python Homework 10.25

30 Oct TCMS 18:30 Python Homework 10.25

Question 1.

Write a program that asks for your name, then asks for your age, then prints a message with your name and age in it.

Input example:
What is your name? Kevin
What is your age? 12

Output example:
Kevin is 12 years old

Question 2.

Write a program that asks for two integer numbers, then displays the addition equation of these two numbers.

Input sample:
Number 1: 19
Number 2: 25

Output sample:
19 + 25 = 44

Use input() to ask question and get answer, for example:

num1 = input("Number 1: ")

However, you can only get string data type of answer. In order to get integer number as dimensions, you need to use int(input(…..)) which will convert from string answer into a integer number, for example:

num1 = int(input("Number 1: "))
No Comments

Sorry, the comment form is closed at this time.