Year-month-week expression

Advertisements I have a data written in specific expression. To simplify the data, here is the example I made: df<-data.frame(date=c(2012034,2012044,2012051,2012063,2012074), math=c(100,100,23,46,78)) 2012034 means 4th week of march,2012. Likewise 2012044 means 4th week of April,2012. I was trying to make the values of date expressing some order. The reason why I have to do this is… Read More Year-month-week expression

How to generate a random number with the amount of digits, the user enters?

Advertisements I’m making a small math program for practice purposes. The user is supposed to enter, how many digits the two summands should have. I did this as shown below: import random digits = int(input(“How many digits should the numbers have? “)) if digits == 1: while True: num1 = random.randint(0,9) num2 = random.randint(0,9) solution… Read More How to generate a random number with the amount of digits, the user enters?