Skip to content

Instantly share code, notes, and snippets.

View chauhan-tarun's full-sized avatar

Tarun Chauhan chauhan-tarun

View GitHub Profile
@chauhan-tarun
chauhan-tarun / RealFilePath.java
Created November 26, 2018 11:49
Get absolute path of any file in android. Credit : Unknown
package com.example.pathutils
import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
@chauhan-tarun
chauhan-tarun / PythonWhileLoopExerciseAnswers2.py
Created April 8, 2018 09:19
Exercise answers of video tutorial "Python 3 for beginners - #7. While Loop" by TheTechnicalFist : https://youtu.be/PBToc_O7OzY
# 1. Write a program to print all odd numbers Between 1 to 100.
# Take count
count = 1
# Run while loop from 1 to 100
while count <= 100:
# Check if number is odd and print it in console
if count % 2 != 0:
print(count)
@chauhan-tarun
chauhan-tarun / PythonConditionsExerciseAnswers2.py
Created April 1, 2018 09:26
Exercise answers of video tutorial "Python 3 for beginners - #5.Conditions" by TheTechnicalFist : https://youtu.be/HhcnV7rB86E
# 1. Take input from user, test whether it is even or odd
# Take input
number = eval(input("Enter a number : "))
# Check if number is even or odd
if number % 2 == 0:
print("It is an even number")
else:
print("It is an odd number")
@chauhan-tarun
chauhan-tarun / PythonConditionsExerciseAnswers.py
Created March 25, 2018 10:17
Exercise answers of video tutorial "Python 3 for beginners - #5.Conditions" by TheTechnicalFist : https://youtu.be/Lmrpdmk9Hxo
# #########################################################
# Question 1.
# Get two number from user
input1 = eval(input("Enter number 1 : "))
input2 = eval(input("Enter number 2 : "))
# Check which number is greater
if input1 > input2:
print(input1, " is greater.")
elif input1 < input2:
@chauhan-tarun
chauhan-tarun / PythonInputsExerciseAnswers.py
Last active March 17, 2018 14:33
Exercise answers of video tutorial "Python 3 for beginners - #4. Inputs" by TheTechnicalFist : https://youtu.be/Lmrpdmk9Hxo
# Take two global values to perform all operations in this program
value1 = eval(input("Enter first integer value : "))
value2 = eval(input("Enter second integer value : "))
# Question 1. Create a program to Subtract two or more values
print(value1, " - ", value2, " = ", value1 - value2)
# Question 2. Create a program to Multiply two or more values
print(value1, " * ", value2, " = ", value1 * value2)