dev-resources.site
for different kinds of informations.
Day 5: Writing our first program in python with home🧡work
Published at
7/19/2024
Categories
python
100daysofcode
coding
computer
Author
aryan015
index
In this blog we will cover to take input and print it on the display.
input and output in python
You can take input from the user using input
function. Remember input function implicit convert input to string. If you enter number then you cannot perform operations on it.
# you can pass string param to input to display 🧡
import datetime # inbuilt module to play with dates in py
today = datetime.date.today() # datetime.date(2024, 7, 19)
current_year = today.year # 2024
print(current_year) # This will display the current year (e.g., 2024)
# int converts string to int
DOB = int(input('Enter you age')) # 1998
# calculate your age
print(current_year - DOB) # 26
Thank you
Articles
12 articles in total
Set STL in CPP 👨‍🎓
read article
Media Attribute in HTML
read article
LocalStorage VS SessionStorage VS Cookie
read article
Day 7: Create a calculator in Python [exercise]
read article
Symbols and Objects in JS♥
read article
🍑understanding windows Command Line Interface
read article
Useful npm commands 👩‍💻
read article
async-await and promises explained in JS [simplified]
read article
🧡how to set precision in cpp for floating or double datatype 💪
read article
🧡How to take input in javascript using console (codechef)
read article
day 6: comments and escape sequence and flushes in python 🏄‍♀️
read article
Day 5: Writing our first program in python with home🧡work
currently reading
Featured ones: