Unit 3 - Lesson 8

31.1.1. Understanding Mathematical Functions

import math
num = float(input("num: "))
if (num - int(num) >= 0.5):
	print ("result:", math.ceil(num)) #print the ceil value of num
else:
	print("result:", math.trunc(num)) #print the trunc value of num

31.2.1. Understanding Random Module

(a) random() function returns random values between 0.0 and 1.0 only.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.