Python day 12 Today we will work with the character strings in Python a little bit. 1.Swap Case The task is to swap cases. Convert all lowercase letters to uppercase letters and vice versa.

# Category: Data Science

## Python Little Goal 5

Python Day 11 1.Average Scores When I was in college, getting up for an 8 am Quiz was always a challenge for me, some professors had the policy take the average of a missing Quiz. Of course, Excel can do the job, since I want to be a real Data Scientist, we will learn how to find an average…

## Linear Diophantine Equation 2

Review: Last time, we went over the basic theorems of Linear Diophantine Equation. This time, we will focus on how to solve the problem. One of the most famous examples is “Chicken Bunny in the Same Cage“.

## Python Little Goal 4

Python Day 10 Leap Year I have a friend Cindy, she was actually born on Feb.29th, and I remember we celebrated her birthday together 2012 in the Maths place! Leap Year was adapted in Gregorian Calendar. There are Three Criteria:

## Linear Diophantine Equation1

In Number Theory Class, Dr.Cavior told us a real story, One Sunday morning 🌞, he just made a cup of freshly brewed coffee☕ and started to read a book 📒, then he got a call from a friend ☎. The friend was asking for his help with a 1 Million Dollars McDonald’s Puzzle that she was trying for couple days!

## Python Little Goal 3

Python Day 9 Today we will try the basic Arithmetic Operators including , + , – ,* ,/ and squares in Python. Arithmetic Operators: The first line contains the sum of the two numbers. The second line contains the difference of the two numbers (first – second). The third line contains the product of the two numbers. The fourth line…

## Geometric Series with Python

Background Story : There were a couple of mathematicians went to a bar, the first guy ordered one beer, the second guy asked for 1/2 of a beer, the third guy asked for 1/4 of a beer, the fourth ordered 1/8 of a beer, and so on… The hot bartender rolled her eyes, poured two beers, and says, “Here, you…

## The Chinese Remainder Theorem

Chinese Remainder Theorem Background Story: back in the Han dynasty, there is a famous General Han Xin. In order to prevent the spy in the army to detect the number of his soldiers, he used an advanced Counting System (韩信点兵). Instead off directly counting from 1 to n, he asked his soldiers to number off from 3 times. First time 1…

## Python Little Goal 2

Python Day 8 Problem 1: Factorial Write a factorial function that takes a positive integer, N as a parameter and prints the result of N! Solution: def factor(n): a=1 for i in range (1,n+1): a=a*i print(a) factor(3) 6 factor(5) 120 Problem 2: Age Create a function age() should perform the following conditional actions: If n is between 0 to 12, print Young. If 13 and 19,…

## Python Little Goal 1

Python Day 7 Problem 1: Given an array of integers, find the sum of its elements. For example, if the array ar=[1,2,3] , so return 6 . Solution: import math ar=[1, 2, 3, 4, 10, 11] def simplesumarray(ar): return(sum(ar)) simplesumarray(ar) 31 Problem 2: Given the meal price ( meal), tip percent (tip), and tax percent ( tax) for a meal, find and print the meal’s total integer cost: Solution:…