Using replit.com for my py coding and execution.
# --------------------------------------- print() ----------------------------------------------
#print() function to print the contents in the console output
print("Hello World")
# To add 2 strings and print, we can use the + operator. Note that both the values in the operation are strings.
print("Add 2 strings using '+' operator: 'Ram' + 'sundar' will give: " + "Ram" + "sundar")
# From the above 2 statements, we can see that Strings can be represented in single or double quotes
# --------------------------------------- input() ----------------------------------------------
# The input values are always string. So if we need an int/float, we should convert the data type.
user_name = input('Enter your name')
print("Name: " + user_name)
#OR as below without using the help of a variable
print ( "Name" " + input('Enter your name'))
age = int(input("Enter age"))
print ("Age is :" + str(age))
-----------------------------------------End of Day 1 ----------------------------------------------
No comments:
Post a Comment