Friday, 28 January 2022
Python practice programs for beginners - Day4
Welcome to the 30-day challenge of Python practising for beginners.
Day 3 Solution:
Program:
Day 4:
Type Casting:
In the above example if you have noticed we got 2 inputs from the user.
Name and Age, where name is a String and Age is a number but in the above output, you can see that is also String.
To convert one type of data into another type we need to do Type Casting.
Syntax:
type_name(variable)
Example:
Program:
So after typecasting, you can see that the type of Age variable is int which is a number.
Practice Program Day 4:
Write a program:
--> Get different data about a person
--> Find the type of data getting stored
--> Try to change the type of a variable and print it
Try to complete the task.
The output will be displayed in the next post.
Subscribe to:
Post Comments
(
Atom
)
nice. all the best.
ReplyDelete