Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #### int ####
- ec2-user@DESKTOP-Q259SHJ ~$ python3
- Python 3.9.2 (default, Feb 28 2021, 17:03:44)
- [GCC 10.2.1 20210110] on linux
- Type "help", "copyright", "credits" or "license" for more information.
- >>>
- >>>
- >>> x = 5
- >>>
- >>> y = 10
- >>>
- >>>
- >>> print(x)
- 5
- >>>
- >>> type(x)
- <class 'int'>
- >>>
- >>> total = x + y
- >>>
- >>> print(total)
- 15
- >>>
- >>> type(total)
- <class 'int'>
- #### Float ####
- >>> x = 5.15
- >>>
- >>> y = 10.15
- >>>
- >>> total = x + y
- >>>
- >>> print(total)
- 15.3
- >>> type(total)
- <class 'float'>
- #### String ###
- >>> name = "Vysakh"
- >>>
- >>> x = "@"
- >>>
- >>> company = "metclouds"
- >>>
- >>> tld = ".com"
- >>>
- >>> gmail_id = name + x + company + tld
- >>>
- >>> print(gmail_id)
- Vysakh@metclouds.com
- >>>
- >>> type(gmail_id)
- <class 'str'>
- >>> x = "5"
- >>>
- >>> y = "10"
- >>>
- >>> total = x + y
- >>>
- >>> print(total)
- 510
- >>>
- >>> type(total)
- <class 'str'>
- #### Miscellaneous ###
- >>> name = "Prince"
- >>>
- >>> total = name * 5
- >>>
- >>> print(total)
- PrincePrincePrincePrincePrince
- >>>
- >>>
- >>> type(total)
- <class 'str'>
- ### Float Testing ###
- >>> x = 10.0
- >>>
- >>> y = 5.0
- >>>
- >>>
- >>> total = x / y
- >>>
- >>> print(total)
- 2.0
- >>>
- >>> type(total)
- <class 'float'>
- #### Difference b/w % and / ####
- >>> x = 9
- >>>
- >>> y =6
- >>>
- >>> total = x % y
- >>>
- >>> print(total)
- 3
- >>>
- >>>
- >>> total = x / y
- >>>
- >>> print(total)
- 1.5
Advertisement
Add Comment
Please, Sign In to add comment